summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/declarative/state.qml
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-06-08 00:50:07 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-06-09 23:36:31 (GMT)
commitce8a3100868e2c545d0af3332e9b801c1fd0bc3f (patch)
tree3b463fa3262410ad0e3fb9a20d9f1af947502990 /doc/src/snippets/declarative/state.qml
parentc85bf4b51331496fcfb8befb4cdcc56d2fa0a213 (diff)
downloadQt-ce8a3100868e2c545d0af3332e9b801c1fd0bc3f.zip
Qt-ce8a3100868e2c545d0af3332e9b801c1fd0bc3f.tar.gz
Qt-ce8a3100868e2c545d0af3332e9b801c1fd0bc3f.tar.bz2
Move some example code into snippets/ and add other doc fixes
Diffstat (limited to 'doc/src/snippets/declarative/state.qml')
-rw-r--r--doc/src/snippets/declarative/state.qml29
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/src/snippets/declarative/state.qml b/doc/src/snippets/declarative/state.qml
new file mode 100644
index 0000000..0954298
--- /dev/null
+++ b/doc/src/snippets/declarative/state.qml
@@ -0,0 +1,29 @@
+//![0]
+import Qt 4.7
+
+Rectangle {
+ id: myRect
+ width: 100; height: 100
+ color: "black"
+
+ states: [
+ State {
+ name: "clicked"
+ PropertyChanges {
+ target: myRect
+ color: "red"
+ }
+ }
+ ]
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ if (myRect.state == "") // i.e. the default state
+ myRect.state = "clicked";
+ else
+ myRect.state = "";
+ }
+ }
+}
+//![0]