summaryrefslogtreecommitdiffstats
path: root/doc/src/declarative/qdeclarativestates.qdoc
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2011-02-24 16:07:22 (GMT)
committeraxis <qt-info@nokia.com>2011-02-24 16:07:22 (GMT)
commit2b768ad7d4de4862584762a7d106d9cfcc3416df (patch)
tree0ddfe84f345d7e61ce71daa51fbbfb373c3e3106 /doc/src/declarative/qdeclarativestates.qdoc
parentbb7d9bcc8e0c617091e91f7a40f3d33f8c1cdec1 (diff)
parentca7be48b7a150952a9657d1000941fb986e5bb2b (diff)
downloadQt-2b768ad7d4de4862584762a7d106d9cfcc3416df.zip
Qt-2b768ad7d4de4862584762a7d106d9cfcc3416df.tar.gz
Qt-2b768ad7d4de4862584762a7d106d9cfcc3416df.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt into earth-master
Conflicts: src/network/access/qnetworkreplyimpl.cpp tests/auto/moc/tst_moc.cpp
Diffstat (limited to 'doc/src/declarative/qdeclarativestates.qdoc')
-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 c6160c5..6d5aebc 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.
-
*/