# class Button

###

Module | solid
Namespace | Solid
Class | Button
Inherits | Solid::DeviceInterface

This device interface is available on button devices.

A button is a device, like power button or lid switch, that can be pressed by user. Some buttons can have two states (Enabled/Disabled, On/Off ...), other buttons haven't state.

Author Davide Bettio <davbet@aliceposta.it>

### enums

- ButtonType { LidButton, PowerButton, SleepButton, UnknownButtonType }

enum details

### methods

- Button (backendObject)

  returns ctor
  Not implemented
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  backendObject | QObject |

  Creates a new Button object. You generally won't need this. It's created when necessary using Device.as().

  backendObject - the device interface object provided by the backend

  See also Solid.Device.as()

- Button (a0)

  returns ctor
  Not implemented
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QObject |

- deviceInterfaceType ( )

  returns Solid::DeviceInterface.Type
  static

  Get the Solid.DeviceInterface.Type of the Button device interface.

  Returns the Button device interface type

  See also Solid.DeviceInterface.Type

- hasState ( )

  returns bool

  Indicates if the button mantains state (Can toggled on/off).

  Returns true if the button maintains state, false otherwise.

  See also stateValue()

- pressed (type, udi)

  returns Nothing
  SIGNAL ("pressed (ButtonType, const QString&)")

  Argument | Type | Default
  --- | --- | ---
  type | Solid::Button.ButtonType |
  udi | QString |

  This signal is emitted when the button is pressed.

  type - the type of button device, it's one of the type Solid.Button.ButtonType

  See also Solid.Button.ButtonType

  udi - the UDI of the button

- stateValue ( )

  returns bool

  Retrieves the state of the button. A button can have two states (Enabled/Disabled, On/Off ...). Available only if hasState is true.

  Returns true if the button is enabled, false otherwise.

  See also hasState()

- type ( )

  returns Solid::Button.ButtonType

  Retrieves the type of button device.

  Returns the type of button device.

  See also Solid.Button.ButtonType

### enums - detail

- ButtonType { LidButton, PowerButton, SleepButton, UnknownButtonType }

  This enum type defines the type of button.

  - LidButton : The switch on a laptop that senses whether the lid is open or closed. - PowerButton : The main power button on the computer. - SleepButton : The sleep button on a computer capable of putting the computer into a suspend state. - UnknownButtonType : The type of the button is unknow.

  | LidButton | - | - |
  | PowerButton | - | - |
  | SleepButton | - | - |
  | UnknownButtonType | - | - |