diff options
author | Yann Bodson <yann.bodson@nokia.com> | 2009-10-26 05:57:41 (GMT) |
---|---|---|
committer | Yann Bodson <yann.bodson@nokia.com> | 2009-10-26 05:57:41 (GMT) |
commit | 33071ea2211633df29fe14c5d196785d163253a6 (patch) | |
tree | 6c03fa4dcd8660d6fe1c62838b5109792bb00d49 /examples/declarative/connections/connections.qml | |
parent | 28cd6e0ed60df6f86a9d736b71ed00e26c224cdb (diff) | |
download | Qt-33071ea2211633df29fe14c5d196785d163253a6.zip Qt-33071ea2211633df29fe14c5d196785d163253a6.tar.gz Qt-33071ea2211633df29fe14c5d196785d163253a6.tar.bz2 |
improve connections example.
Diffstat (limited to 'examples/declarative/connections/connections.qml')
-rw-r--r-- | examples/declarative/connections/connections.qml | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/examples/declarative/connections/connections.qml b/examples/declarative/connections/connections.qml index b693b7e..5dc211e 100644 --- a/examples/declarative/connections/connections.qml +++ b/examples/declarative/connections/connections.qml @@ -1,32 +1,30 @@ import Qt 4.6 Rectangle { - id: rect - color: "blue" - width: 40 - height: 30 + id: window; color: "#343434" + width: 640; height: 480 - Rectangle { - id: dot - color: "red" - width: 3 - height: 3 - x: rect.width/2 - y: rect.height/2 + function turnLeft() { + image.rotation -= 90 + } + function turnRight() { + image.rotation += 90 } - MouseRegion { - id: mr - anchors.fill: rect + Image { + id: image; source: "bg1.jpg"; anchors.centerIn: parent; transformOrigin: Item.Center + rotation: Behavior { NumberAnimation { easing: "easeOutCubic"; duration: 300 } } } - Connection { - sender: mr - signal: "clicked(mouse)" - script: { - color = "green"; - dot.x = mouse.x-1; - dot.y = mouse.y-1; - } + Button { + id: leftButton; image: "rotate-left.png" + anchors { left: parent.left; bottom: parent.bottom; leftMargin: 10; bottomMargin: 10 } + } + Button { + id: rightButton; image: "rotate-right.png" + 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() } } |