diff options
-rw-r--r-- | examples/declarative/connections/connections.qml | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/examples/declarative/connections/connections.qml b/examples/declarative/connections/connections.qml index ef2cb54..c140017 100644 --- a/examples/declarative/connections/connections.qml +++ b/examples/declarative/connections/connections.qml @@ -5,15 +5,11 @@ Rectangle { id: window; color: "#646464" width: 640; height: 480 - function turnLeft() { - image.rotation -= 90 - } - function turnRight() { - image.rotation += 90 - } + property int angle: 0 Image { id: image; source: "content/bg1.jpg"; anchors.centerIn: parent; transformOrigin: Item.Center + rotation: window.angle rotation: Behavior { NumberAnimation { easing.type: "OutCubic"; duration: 300 } } } @@ -26,6 +22,6 @@ Rectangle { anchors { right: parent.right; bottom: parent.bottom; rightMargin: 10; bottomMargin: 10 } } - Connection { sender: leftButton; signal: "clicked()"; script: window.turnLeft() } - Connection { sender: rightButton; signal: "clicked()"; script: window.turnRight() } + Connection { sender: leftButton; signal: "clicked()"; script: window.angle -= 90 } + Connection { sender: rightButton; signal: "clicked()"; script: window.angle += 90 } } |