[Qt-qml] Flippable example: some questions
Stephen Collyer
scollyer at netspinner.co.uk
Wed Aug 4 18:17:59 CEST 2010
The following example comes from the docs for Flippable:
import Qt 4.7
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
}
}
There are a couple of things I don't follow:
1) The item enters the "back" state when flipped is true,
but I can't see anything that should occur when flipped is
false. However, the example performs a flip on every mouse
click, and each mouse click toggles flipped between true and false.
2) Where does the NumberAnimation get its to and from properties ?
The docs mention that it uses the "value set in the start state
of the transition", but it's not clear to me what that means here.
Can anyone explain ?
--
Stephen Collyer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20100804/78b5cd44/attachment.html
More information about the Qt-qml
mailing list