summaryrefslogtreecommitdiffstats
path: root/examples/declarative/tutorials/helloworld/t3/tutorial3.qml
blob: b80065d9ae5ac0ecd61c4d06f7f2418ff31b1229 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import Qt 4.6

Rectangle {
    id: page
    width: 480
    height: 200
    color: "LightGrey"
    Text {
        id: helloText
        text: "Hello world!"
        font.pointSize: 24
        font.bold: true
        y: 30
        anchors.horizontalCenter: page.horizontalCenter
        states: [
            State {
                name: "down"
                when: mouseRegion.pressed == true
                PropertyChanges {
                    target: helloText
                    y: 160
                    color: "red"
                }
            }
        ]
        transitions: [
            Transition {
                from: "*"
                to: "down"
                reversible: true
                ParallelAnimation {
                    NumberAnimation {
                        properties: "y"
                        duration: 500
                        easing: "easeOutBounce"
                    }
                    ColorAnimation { property: "color"; duration: 500 }
                }
            }
        ]
    }
    MouseRegion { id: mouseRegion; anchors.fill: helloText }
    Grid {
        id: colorPicker
        x: 0
        anchors.bottom: page.bottom
        width: 120; height: 50
        rows: 2; columns: 3
        Cell { color: "#ff0000" }
        Cell { color: "#00ff00" }
        Cell { color: "#0000ff" }
        Cell { color: "#ffff00" }
        Cell { color: "#00ffff" }
        Cell { color: "#ff00ff" }
    }
}