Meego Wiki
Views

ToggleButton API Snapshot

From MeeGo wiki
(Difference between revisions)
Jump to: navigation, search
(created ToggleButton API Snapshot page)
(removed private properties)
Line 13: Line 13:
;''alias'' labelColorOff  
;''alias'' labelColorOff  
:Points to the color of the right label (off state)
:Points to the color of the right label (off state)
-
 
-
=Private Properties=
 
-
;''real'' width
 
-
:Per default the width of the source image.
 
-
;''real'' height
 
-
:Per default the height of the source image.
 
   
   
=Signals=
=Signals=

Revision as of 12:23, 28 April 2011

Contents

Description

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.

API properties

alias onLabel
Points to the text of the left button label (on state)
alias offLabel
Points to the text of the right button label (off state)
bool on
True if the button is currently set to the left option (on state)
alias labelColorOn
Points to the color of the left label (on state)
alias labelColorOff
Points to the color of the right label (off state)

Signals

toggled
Emitted if the button is toggled.
Parameter:
  • bool isOn, indicates if the button was set to the left or right option.

Functions

toggle
Switches the button from its current option to the other option and emits the toggled signal

Example

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")
    }
}
Personal tools