summaryrefslogtreecommitdiffstats
path: root/doc/src
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2010-03-31 04:25:23 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2010-03-31 04:31:39 (GMT)
commit6905c23c8363ce3f6698b0bc81dc81eef0f8de20 (patch)
treeb4d2f0036238ef2670f7e1c63ad3b2959342ed46 /doc/src
parent8c757e4b84748c19e5f66da432d8af2e7db40cde (diff)
downloadQt-6905c23c8363ce3f6698b0bc81dc81eef0f8de20.zip
Qt-6905c23c8363ce3f6698b0bc81dc81eef0f8de20.tar.gz
Qt-6905c23c8363ce3f6698b0bc81dc81eef0f8de20.tar.bz2
Improve flipable example.
Diffstat (limited to 'doc/src')
-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]
+