API Documentation
Documentation for developing SailfishOS applicationsSwitch QML Type
A toggle button with an icon More...
Import Statement: | import Sailfish.Silica 1.0 |
Properties
- automaticCheck : bool
- busy : bool
- checked : bool
- down : bool
- highlighted : bool
- icon : Image
Detailed Description
The Switch type provides a Sailfish-styled toggle button with an icon.
Here is a simple Switch:
import QtQuick 2.2 import Sailfish.Silica 1.0 Column { Switch { id: mute icon.source: "mute.png" } Label { text: "The sound is " + (mute.checked ? "off" : "on") } }
Switch inherits the QtQuick MouseArea type, so any properties, signals and methods of MouseArea are also available to Switch objects. See the MouseArea documentation for its full list of available properties, signals and methods.
See also Button, IconButton, and TextSwitch.
Property Documentation
If true, the Switch is automatically toggled between the checked and unchecked states when clicked. The default value is true
.
If automaticCheck
is false
, the user must handle the clicked()
signal and set the value of checked appropriately. This is primarily useful when the switch is connected to an external state that cannot be simply bound to the checked properly.
See also checked.
This property holds whether the Switch is in a busy state. When busy the indicator will flash and the Switch will be disabled. The busy state is useful when applying a change to a setting does not happen instantaneously.
This property holds whether the Switch is checked. Clicking on the switch toggles checked
between true
and false
.
This property is true while the button is pressed and the touch position remains within the button area.
This property determines whether the switch is shown highlighted. By default it is bound to down.