summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/declarative/anchorchanges.qml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/snippets/declarative/anchorchanges.qml')
-rw-r--r--doc/src/snippets/declarative/anchorchanges.qml28
1 files changed, 28 insertions, 0 deletions
diff --git a/doc/src/snippets/declarative/anchorchanges.qml b/doc/src/snippets/declarative/anchorchanges.qml
new file mode 100644
index 0000000..6c0a0ad
--- /dev/null
+++ b/doc/src/snippets/declarative/anchorchanges.qml
@@ -0,0 +1,28 @@
+//![0]
+import Qt 4.7
+
+Item {
+ id: window
+ width: 200; height: 200
+
+ Rectangle { id: myRect; width: 100; height: 100; color: "red" }
+
+ states: State {
+ name: "reanchored"
+
+ AnchorChanges {
+ target: myRect
+ anchors.top: window.top
+ anchors.bottom: window.bottom
+ }
+ PropertyChanges {
+ target: myRect
+ anchors.topMargin: 3
+ anchors.bottomMargin: 3
+ }
+ }
+
+ MouseArea { anchors.fill: parent; onClicked: window.state = "reanchored" }
+}
+//![0]
+