summaryrefslogtreecommitdiffstats
path: root/examples/declarative/connections/connections.qml
blob: 07f71bbab3cec9a9046639fc6bcb7e97a1a371ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import Qt 4.6
import "content"

Rectangle {
    id: window; color: "#646464"
    width: 640; height: 480

    function turnLeft() {
        image.rotation -= 90
    }
    function turnRight() {
        image.rotation += 90
    }

    Image {
        id: image; source: "content/bg1.jpg"; anchors.centerIn: parent; transformOrigin: Item.Center
        rotation: Behavior { NumberAnimation { easing: "easeOutCubic"; duration: 300 } }
    }

    Button {
        id: leftButton; image: "content/rotate-left.png"
        anchors { left: parent.left; bottom: parent.bottom; leftMargin: 10; bottomMargin: 10 }
    }
    Button {
        id: rightButton; image: "content/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() }
}