aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/examples/example-slideswitch.qdoc
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2012-05-28 11:56:24 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-31 10:40:41 +0200
commit4c671c046e8140bfb8372aab2c38aabe82b102b0 (patch)
tree7a70a75a553dcc806372a6b43ea39da05191db8a /doc/src/examples/example-slideswitch.qdoc
parent0c7669b241aae96fca97acae0b628e627d5bfc4e (diff)
Fix doc snippets paths and parsing errors
qtqml.qdocconf and qtquick.qdocconf now refer to the correct snippets and source directories. Snippet paths in .qdoc and .cpp files have been updated to refer to the new shortened path references, e.g. \snippet qml/file.cpp instead of \snippet doc/src/snippets/qml/file.cpp. This also deletes snippets from src/qml/doc/snippets that belonged under src/quick/doc/snippets (and were already duplicated there anyway) and restores some snippet files that shouldn't have been deleted. Also fixes some inline snippets to use \code .. \endcode instead of \qml .. \endqml as they contained javascript or partial QML snippets that were causing parsing errors from qdoc. There are still snippet errors arising from qmlintro.qdoc as the qmlintro snippets directory that it refers to cannot be located. There are also two references to a removed snippet identifier in examples/qml/cppextensions/plugins/plugin.cpp that need to be fixed in conjunction with the related docs in a later commit as the relevant code has changed and the docs are now invalid. Task-number: QTBUG-25721 Change-Id: I50c665245a74c140470c58a32546591d187dfe4b Reviewed-by: Chris Adams <christopher.adams@nokia.com>
Diffstat (limited to 'doc/src/examples/example-slideswitch.qdoc')
-rw-r--r--doc/src/examples/example-slideswitch.qdoc20
1 files changed, 10 insertions, 10 deletions
diff --git a/doc/src/examples/example-slideswitch.qdoc b/doc/src/examples/example-slideswitch.qdoc
index 61300c9e47..1c8f4d25bb 100644
--- a/doc/src/examples/example-slideswitch.qdoc
+++ b/doc/src/examples/example-slideswitch.qdoc
@@ -32,7 +32,7 @@
\brief A reusable switch component made in QML
This example shows how to create a reusable switch component in QML.
-The code for this example can be found in the \c examples/declarative/ui-components/slideswitch directory.
+The code for this example can be found in the \c examples/tutorials/ui-components/slideswitch directory.
The elements that compose the switch are:
@@ -46,12 +46,12 @@ The elements that compose the switch are:
\endlist
\section1 Switch.qml
-\snippet examples/declarative/ui-components/slideswitch/content/Switch.qml 0
+\snippet examples/tutorials/ui-components/slideswitch/content/Switch.qml 0
\section1 Walkthrough
\section2 Interface
-\snippet examples/declarative/ui-components/slideswitch/content/Switch.qml 1
+\snippet examples/tutorials/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.
@@ -74,14 +74,14 @@ Item {
the text will only be visible when the switch is on.
\section2 Images and user interaction
-\snippet examples/declarative/ui-components/slideswitch/content/Switch.qml 4
+\snippet examples/tutorials/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 examples/declarative/ui-components/slideswitch/content/Switch.qml 5
+\snippet examples/tutorials/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
@@ -89,7 +89,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 examples/declarative/ui-components/slideswitch/content/Switch.qml 6
+\snippet examples/tutorials/ui-components/slideswitch/content/Switch.qml 6
We define the two states of the switch:
\list
@@ -103,13 +103,13 @@ For more information on states see \l{States}.
We add two JavaScript functions to our switch:
-\snippet examples/declarative/ui-components/slideswitch/content/Switch.qml 2
+\snippet examples/tutorials/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 examples/declarative/ui-components/slideswitch/content/Switch.qml 3
+\snippet examples/tutorials/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.
@@ -117,7 +117,7 @@ This second function is called when the knob is released and we want to make sur
For more information on scripts see \l{JavaScript Expressions in QML}.
\section2 Transition
-\snippet examples/declarative/ui-components/slideswitch/content/Switch.qml 7
+\snippet examples/tutorials/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 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.
@@ -126,5 +126,5 @@ For more information on transitions see \l{QML Animation and Transitions}.
\section1 Usage
The switch can be used in a QML file, like this:
-\snippet examples/declarative/ui-components/slideswitch/slideswitch.qml 0
+\snippet examples/tutorials/ui-components/slideswitch/slideswitch.qml 0
*/