aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc')
-rw-r--r--examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc20
1 files changed, 10 insertions, 10 deletions
diff --git a/examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc b/examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc
index 1ebe7eb9f5..3a14dd465a 100644
--- a/examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc
+++ b/examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc
@@ -28,7 +28,7 @@
/*!
\page qmlexampletoggleswitch.html tutorial
-\title QML Example - Toggle Switch
+\title Qt Quick Examples - Toggle Switch
\brief A reusable switch component made in QML
\ingroup qtquickexamples
@@ -48,12 +48,12 @@ The objects that compose the switch are:
\endlist
\section1 Switch.qml
-\snippet quick/ui-components/slideswitch/content/Switch.qml 0
+\snippet ui-components/slideswitch/content/Switch.qml 0
\section1 Walkthrough
\section2 Interface
-\snippet quick/ui-components/slideswitch/content/Switch.qml 1
+\snippet ui-components/slideswitch/content/Switch.qml 1
This property is the interface of the switch. By default, the switch is off and this property is \c false.
It can be used to activate/disactivate the switch or to query its current state.
@@ -76,14 +76,14 @@ Item {
the text will only be visible when the switch is on.
\section2 Images and user interaction
-\snippet quick/ui-components/slideswitch/content/Switch.qml 4
+\snippet ui-components/slideswitch/content/Switch.qml 4
First, we create the background image of the switch.
In order for the switch to toggle when the user clicks on the background, we add a \l{MouseArea} as a child item of the image.
A \c MouseArea has a \c onClicked property that is triggered when the item is clicked. For the moment we will just call a
\c toggle() function. We will see what this function does in a moment.
-\snippet quick/ui-components/slideswitch/content/Switch.qml 5
+\snippet ui-components/slideswitch/content/Switch.qml 5
Then, we place the image of the knob on top of the background.
The interaction here is a little more complex. We want the knob to move with the finger when it is clicked. That is what the \c drag
@@ -91,7 +91,7 @@ property of the \c MouseArea is for. We also want to toggle the switch if the kn
in the \c dorelease() function that is called in the \c onReleased property.
\section2 States
-\snippet quick/ui-components/slideswitch/content/Switch.qml 6
+\snippet ui-components/slideswitch/content/Switch.qml 6
We define the two states of the switch:
\list
@@ -105,13 +105,13 @@ For more information on states see \l{Qt Quick States}.
We add two JavaScript functions to our switch:
-\snippet quick/ui-components/slideswitch/content/Switch.qml 2
+\snippet ui-components/slideswitch/content/Switch.qml 2
This first function is called when the background image or the knob are clicked. We simply want the switch to toggle between the two
states (\e on and \e off).
-\snippet quick/ui-components/slideswitch/content/Switch.qml 3
+\snippet ui-components/slideswitch/content/Switch.qml 3
This second function is called when the knob is released and we want to make sure that the knob does not end up between states
(neither \e on nor \e off). If it is the case call the \c toggle() function otherwise we do nothing.
@@ -119,7 +119,7 @@ This second function is called when the knob is released and we want to make sur
For more information on scripts see \l{Using JavaScript Expressions in QML}.
\section2 Transition
-\snippet quick/ui-components/slideswitch/content/Switch.qml 7
+\snippet ui-components/slideswitch/content/Switch.qml 7
At this point, when the switch toggles between the two states the knob will instantly change its \c x position between 1 and 78.
In order for the knob to move smoothly we add a transition that will animate the \c x property with an easing curve for a duration of 200ms.
@@ -128,5 +128,5 @@ For more information on transitions see \l{Animation and Transitions in Qt Quick
\section1 Usage
The switch can be used in a QML file, like this:
-\snippet quick/ui-components/slideswitch/slideswitch.qml 0
+\snippet ui-components/slideswitch/slideswitch.qml 0
*/