summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets
diff options
context:
space:
mode:
authorJerome Pasion <jerome.pasion@nokia.com>2011-02-08 08:55:32 (GMT)
committerJerome Pasion <jerome.pasion@nokia.com>2011-02-08 08:55:32 (GMT)
commitb18e040ecb0ce6dea9c0d18f1c8a5542cd0e2881 (patch)
tree961ac28e713b76395402dbe5fe26365e020f3617 /doc/src/snippets
parent8f38531acc8139bcbee158458086ab012cb200b6 (diff)
downloadQt-b18e040ecb0ce6dea9c0d18f1c8a5542cd0e2881.zip
Qt-b18e040ecb0ce6dea9c0d18f1c8a5542cd0e2881.tar.gz
Qt-b18e040ecb0ce6dea9c0d18f1c8a5542cd0e2881.tar.bz2
Changed states.qml snippet code
Task-number: QTBUG-16071
Diffstat (limited to 'doc/src/snippets')
-rw-r--r--doc/src/snippets/declarative/states.qml85
1 files changed, 73 insertions, 12 deletions
diff --git a/doc/src/snippets/declarative/states.qml b/doc/src/snippets/declarative/states.qml
index c3b7197..ab6b8d0 100644
--- a/doc/src/snippets/declarative/states.qml
+++ b/doc/src/snippets/declarative/states.qml
@@ -37,24 +37,85 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-//![0]
+//![document]
import QtQuick 1.0
-
+
+//![parent begin]
Rectangle {
- id: myRect
- width: 200; height: 200
- color: "red"
+//![parent begin]
+
+ id: screen
+ width: 400; height: 500
- MouseArea {
- anchors.fill: parent
- onClicked: myRect.state = 'moved'
- }
+
+Rectangle {
+ id: flag
+}
+Column {
+ spacing: 15
+//![signal states]
+Rectangle {
+ id: signal
+ width: 200; height: 200
+ state: "NORMAL"
states: [
State {
- name: "moved"
- PropertyChanges { target: myRect; x: 50; y: 50 }
+ name: "NORMAL"
+ PropertyChanges { target: signal; color: "green"}
+ PropertyChanges { target: flag; state: "FLAG_DOWN"}
+ },
+ State {
+ name: "CRITICAL"
+ PropertyChanges { target: signal; color: "red"}
+ PropertyChanges { target: flag; state: "FLAG_UP"}
}
]
}
-//![0]
+//![signal states]
+
+//![switch states]
+Rectangle {
+ id: signalswitch
+ width: 75; height: 75
+ color: "blue"
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ if (signal.state == "NORMAL")
+ signal.state = "CRITICAL"
+ else
+ signal.state = "NORMAL"
+ }
+ }
+}
+//![switch states]
+
+//![when property]
+Rectangle {
+ id: bell
+ width: 75; height: 75
+ color: "yellow"
+
+ states: State {
+ name: "RINGING"
+ when: (signal.state == "CRITICAL")
+ PropertyChanges {target: speaker; play: "RING!"}
+ }
+}
+//![when property]
+
+Text {
+ id: speaker
+ property alias play: speaker.text
+ text: "NORMAL"
+}
+
+} // end of row
+
+//![parent end]
+}
+//![parent end]
+
+//![document]