Pascaldietz (Talk | contribs) (removed private properties) |
Pascaldietz (Talk | contribs) (→API properties) |
||
| Line 4: | Line 4: | ||
=API properties= | =API properties= | ||
;''alias'' onLabel | ;''alias'' onLabel | ||
| - | : | + | :Pints to the text of the left button label (on state). If onLabel is either to long or empty, an icon will be displayed instead of onLabel as well as offLabel. |
;''alias'' offLabel | ;''alias'' offLabel | ||
| - | :Points to the text of the right button label (off state) | + | :Points to the text of the right button label (off state). If offLabel is either to long or empty, an icon will be displayed instead of offLabel as well as onLabel. |
;''bool'' on | ;''bool'' on | ||
:True if the button is currently set to the left option (on state) | :True if the button is currently set to the left option (on state) | ||
| + | ;''bool'' enabled | ||
| + | :If false, the ToggleButton can't be clicked and uses dimmed graphics. | ||
;''alias'' labelColorOn | ;''alias'' labelColorOn | ||
:Points to the color of the left label (on state) | :Points to the color of the left label (on state) | ||
;''alias'' labelColorOff | ;''alias'' labelColorOff | ||
:Points to the color of the right label (off state) | :Points to the color of the right label (off state) | ||
| - | + | ||
=Signals= | =Signals= | ||
;toggled | ;toggled | ||
Contents |
This is a button which let's the user switch between two options. The button can be toggled by a single click or by swiping in the desired direction.
ToggleButton {
id: onOffToggle
onLabel: qsTr("On")
offLabel: qsTr("Off")
anchors.centerIn: parent
onToggled: {
on ? console.log("Now I'm on") : console.log("Now I'm off")
}
}