summaryrefslogtreecommitdiffstats
path: root/examples/declarative/ui-components/slideswitch/content/Switch.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/ui-components/slideswitch/content/Switch.qml')
-rw-r--r--examples/declarative/ui-components/slideswitch/content/Switch.qml7
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/declarative/ui-components/slideswitch/content/Switch.qml b/examples/declarative/ui-components/slideswitch/content/Switch.qml
index b0ce0c0..2a89177 100644
--- a/examples/declarative/ui-components/slideswitch/content/Switch.qml
+++ b/examples/declarative/ui-components/slideswitch/content/Switch.qml
@@ -53,12 +53,13 @@ Item {
function toggle() {
if (toggleswitch.state == "on")
toggleswitch.state = "off";
- else toggleswitch.state = "on";
+ else
+ toggleswitch.state = "on";
}
//![2]
//![3]
- function dorelease() {
+ function releaseSwitch() {
if (knob.x == 1) {
if (toggleswitch.state == "off") return;
}
@@ -87,7 +88,7 @@ Item {
anchors.fill: parent
drag.target: knob; drag.axis: Drag.XAxis; drag.minimumX: 1; drag.maximumX: 78
onClicked: toggle()
- onReleased: dorelease()
+ onReleased: releaseSwitch()
}
}
//![5]