summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-03-31 06:45:31 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-03-31 06:45:31 (GMT)
commitb6a0595e6479138b9d58c499f4285b357e81b2eb (patch)
tree2e10e8a59ae55f75e44b67a310103a084e8d169f /doc/src/snippets
parente178cf86ff5007d5af31181d064b1bf824ffbc33 (diff)
parenta795a55cf2796a44cf30e002962ebad0588ef740 (diff)
downloadQt-b6a0595e6479138b9d58c499f4285b357e81b2eb.zip
Qt-b6a0595e6479138b9d58c499f4285b357e81b2eb.tar.gz
Qt-b6a0595e6479138b9d58c499f4285b357e81b2eb.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'doc/src/snippets')
-rw-r--r--doc/src/snippets/declarative/flipable.qml37
1 files changed, 37 insertions, 0 deletions
diff --git a/doc/src/snippets/declarative/flipable.qml b/doc/src/snippets/declarative/flipable.qml
new file mode 100644
index 0000000..c837ebc
--- /dev/null
+++ b/doc/src/snippets/declarative/flipable.qml
@@ -0,0 +1,37 @@
+//! [0]
+import Qt 4.6
+
+Flipable {
+ id: flipable
+ width: 240
+ height: 240
+
+ property int angle: 0
+ property bool flipped: false
+
+ front: Image { source: "front.png" }
+ back: Image { source: "back.png" }
+
+ transform: Rotation {
+ origin.x: flipable.width/2; origin.y: flipable.height/2
+ axis.x: 0; axis.y: 1; axis.z: 0 // rotate around y-axis
+ angle: flipable.angle
+ }
+
+ states: State {
+ name: "back"
+ PropertyChanges { target: flipable; angle: 180 }
+ when: flipable.flipped
+ }
+
+ transitions: Transition {
+ NumberAnimation { properties: "angle"; duration: 1000 }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: flipable.flipped = !flipable.flipped
+ }
+}
+//! [0]
+