summaryrefslogtreecommitdiffstats
path: root/doc/src/declarative
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2011-01-21 15:10:54 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2011-01-21 15:10:54 (GMT)
commit84a1df764bf2e29e9e6e43f4f0e1a69201199fbc (patch)
tree73ece498671d7c7ed1df50c9a28b6be0fdfc892b /doc/src/declarative
parent2d5d354068e18de999c0316c2356726f9fe69fca (diff)
downloadQt-84a1df764bf2e29e9e6e43f4f0e1a69201199fbc.zip
Qt-84a1df764bf2e29e9e6e43f4f0e1a69201199fbc.tar.gz
Qt-84a1df764bf2e29e9e6e43f4f0e1a69201199fbc.tar.bz2
Doc: Fixed the syntax of QML code snippets.
Diffstat (limited to 'doc/src/declarative')
-rw-r--r--doc/src/declarative/qdeclarativestates.qdoc37
1 files changed, 16 insertions, 21 deletions
diff --git a/doc/src/declarative/qdeclarativestates.qdoc b/doc/src/declarative/qdeclarativestates.qdoc
index b663d43..69b348b 100644
--- a/doc/src/declarative/qdeclarativestates.qdoc
+++ b/doc/src/declarative/qdeclarativestates.qdoc
@@ -71,7 +71,7 @@ of an item, set the \l {Item::}{state} property to the name of the state.
Non-Item objects can use states through the StateGroup element.
-\section1 Creating states
+\section1 Creating States
To create a state, add a \l State object to the item's \l {Item::}{states} property,
which holds a list of states for that item.
@@ -91,7 +91,7 @@ objects, not just the object that owns the state. For example:
\qml
Rectangle {
- ...
+ // ...
states: [
State {
name: "moved"
@@ -106,14 +106,7 @@ As a convenience, if an item only has one state, its \l {Item::}{states}
property can be defined as a single \l State, without the square-brace list
syntax:
-\qml
-Item {
- ...
- states: State {
- ...
- }
-}
-\endqml
+\snippet doc/src/snippets/declarative/propertyanimation.qml single state
A \l State is not limited to performing modifications on property values. It
can also:
@@ -130,7 +123,7 @@ demonstrates how to declare a basic set of states and apply animated
transitions between them.
-\section1 The default state
+\section1 The Default State
Of course, the \l Rectangle in the example above could have simply been moved
by setting its position to (50, 50) in the mouse area's \c onClicked handler.
@@ -146,7 +139,7 @@ like this:
\qml
Rectangle {
- ...
+ // ...
MouseArea {
id: mouseArea
@@ -154,8 +147,9 @@ Rectangle {
}
states: State {
- name: "moved"; when: mouseArea.pressed
- ...
+ name: "moved"
+ when: mouseArea.pressed
+ // ...
}
}
\endqml
@@ -171,7 +165,7 @@ using the \l {State::}{when} property, the above code could be changed to:
\qml
Rectangle {
- ...
+ // ...
MouseArea {
anchors.fill: parent
@@ -181,7 +175,7 @@ Rectangle {
states: State {
name: "moved"
- ...
+ // ...
}
}
\endqml
@@ -191,7 +185,7 @@ as it provides a simpler (and a better, more declarative) solution than
assigning the state from signal handlers.
-\section1 Animating state changes
+\section1 Animating State Changes
State changes can be easily animated through \l {Transitions}{transitions}. A
@@ -203,12 +197,14 @@ movement of the \l Rectangle would be animated:
\qml
Rectangle {
- ...
+ // ...
- MouseArea { ... }
+ MouseArea {
+ // Handle mouse events...
+ }
states: [
- ...
+ // States are defined here...
]
transitions: [
@@ -224,5 +220,4 @@ during a state change within this item, their values should be animated over 500
milliseconds.
See the \l Transitions documentation for more information.
-
*/