summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/visual/animation/bindinganimation/bindinganimation.qml
blob: 1afd4cdc8fc0aae90d45f6dd41030169035cc4a2 (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
32
33
34
35
36
37
38
39
40
import Qt 4.6

Rectangle {
    color: "blue"
    width: 320
    height: 240
    id: Page
    Rectangle {
        id: MyRectangle
        width: 100
        height: 100
        color: "red"
        x: 10
    }
    states: [
        State {
            name: "hello"
            PropertyChanges {
                target: MyRectangle
                x: 50 + 50
            }
            PropertyChanges {
                target: MyMouseRegion
                onClicked: Page.state = ''
            }
        }
    ]
    transitions: [
        Transition {
            NumberAnimation {
                matchProperties: "x"
            }
        }
    ]
    MouseRegion {
        id: MyMouseRegion
        anchors.fill: parent
        onClicked: { Page.state= 'hello' }
    }
}