summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-03-08 04:49:03 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-03-08 04:49:03 (GMT)
commitad7e15422be2ae2d3bbae75d0fa1dd99b302283d (patch)
treecae0daccb1fa608a7f057fce917e02b0845f2259 /examples
parentb35bc4ba38992dde4c35c138caa52c018d80b350 (diff)
downloadQt-ad7e15422be2ae2d3bbae75d0fa1dd99b302283d.zip
Qt-ad7e15422be2ae2d3bbae75d0fa1dd99b302283d.tar.gz
Qt-ad7e15422be2ae2d3bbae75d0fa1dd99b302283d.tar.bz2
Add Flipable example.
Task-number: QT-2824
Diffstat (limited to 'examples')
-rw-r--r--examples/declarative/flipable/back.pngbin0 -> 5048 bytes
-rw-r--r--examples/declarative/flipable/flipable.qml37
-rw-r--r--examples/declarative/flipable/front.pngbin0 -> 6431 bytes
3 files changed, 37 insertions, 0 deletions
diff --git a/examples/declarative/flipable/back.png b/examples/declarative/flipable/back.png
new file mode 100644
index 0000000..0b4cafc
--- /dev/null
+++ b/examples/declarative/flipable/back.png
Binary files differ
diff --git a/examples/declarative/flipable/flipable.qml b/examples/declarative/flipable/flipable.qml
new file mode 100644
index 0000000..c837ebc
--- /dev/null
+++ b/examples/declarative/flipable/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]
+
diff --git a/examples/declarative/flipable/front.png b/examples/declarative/flipable/front.png
new file mode 100644
index 0000000..796b605
--- /dev/null
+++ b/examples/declarative/flipable/front.png
Binary files differ