summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/declarative/state.qml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/snippets/declarative/state.qml')
-rw-r--r--doc/src/snippets/declarative/state.qml23
1 files changed, 5 insertions, 18 deletions
diff --git a/doc/src/snippets/declarative/state.qml b/doc/src/snippets/declarative/state.qml
index a99c2e2..af6b103 100644
--- a/doc/src/snippets/declarative/state.qml
+++ b/doc/src/snippets/declarative/state.qml
@@ -44,26 +44,13 @@ import Qt 4.7
Rectangle {
id: myRect
width: 100; height: 100
- color: "black"
+ color: "red"
- states: [
- State {
- name: "clicked"
- PropertyChanges {
- target: myRect
- color: "red"
- }
- }
- ]
+ MouseArea { id: mouseArea; anchors.fill: parent }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (myRect.state == "") // i.e. the default state
- myRect.state = "clicked";
- else
- myRect.state = "";
- }
+ states: State {
+ name: "hidden"; when: mouseArea.pressed
+ PropertyChanges { target: myRect; opacity: 0 }
}
}
//![0]