summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-11-24 06:43:27 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-11-24 06:43:27 (GMT)
commitfe996d89f4441d9c3ee341083a2bf133a6a57114 (patch)
tree215f9251501517fd37aa8f9d1e94c5ead92a1f91 /src/declarative/graphicsitems
parent31540e4b5177073d71b98e296ad7d59faf63b383 (diff)
parentb45102dfd37112a754dd54f3e53ca6fce08f24cc (diff)
downloadQt-fe996d89f4441d9c3ee341083a2bf133a6a57114.zip
Qt-fe996d89f4441d9c3ee341083a2bf133a6a57114.tar.gz
Qt-fe996d89f4441d9c3ee341083a2bf133a6a57114.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/graphicsitems')
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsflipable.cpp46
1 files changed, 28 insertions, 18 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsflipable.cpp b/src/declarative/graphicsitems/qmlgraphicsflipable.cpp
index 57d2ee1..9e48bf2 100644
--- a/src/declarative/graphicsitems/qmlgraphicsflipable.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsflipable.cpp
@@ -68,29 +68,39 @@ public:
Flipable allows you to specify a front and a back and then flip between those sides.
+ Here's an example that flips between the front and back sides when clicked:
+
\qml
-Flipable {
- width: 40; height: 40
-
- transform: Rotation {
- id: rotation
- origin.x: 20; origin.y: 120
- axis.x: 0; axis.y: 1; axis.z: 0
- angle: 0
- }
- front: Image { source: "front.png" }
- back: Image { source: "back.png" }
+ Flipable {
+ id: flipable
+ width: 250; height: 250
+ property int angle: 0
- states: State {
- name: "back"
- SetProperties { target: rotation; angle: 180 }
- }
+ transform: Rotation {
+ id: 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
+ }
+
+ front: Image { source: "front.png" }
+ back: Image { source: "back.png" }
- transitions: Transition {
- NumberAnimation { easing: "easeInOutQuad"; matchProperties: "rotation" }
+ states: State {
+ name: "back"
+ PropertyChanges { target: flipable; angle: 180 }
+ }
+
+ transitions: Transition {
+ NumberAnimation { matchProperties: "angle"; duration: 2000 }
+ }
+
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: flipable.state = (flipable.state == 'back' ? 'front' : 'back')
+ }
}
-}
\endqml
\image flipable.gif