summaryrefslogtreecommitdiffstats
path: root/examples/declarative/tutorials/helloworld/t3/tutorial3.qml
blob: 664bf4524a3ca668aebe2ed7d3893ec202c5c950 (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
Rect {
    id: Page
    width: 480
    height: 200
    color: "LightGrey"
    Text {
        id: HelloText
        text: "Hello world!"
        font.size: 24
        font.bold: true
        y: 30
        anchors.horizontalCenter: Page.horizontalCenter
        states: [
            State {
                name: "down"
                when: MouseRegion.pressed == true
                SetProperties {
                    target: HelloText
                    y: 160
                    color: "red"
                }
            }
        ]
        transitions: [
            Transition {
                fromState: "*"
                toState: "down"
                reversible: true
                ParallelAnimation {
                    NumberAnimation {
                        properties: "y"
                        duration: 500
                        easing: "easeOutBounce"
                    }
                    ColorAnimation { property: "color"; duration: 500 }
                }
            }
        ]
    }
    MouseRegion { id: MouseRegion; anchors.fill: HelloText }
    GridLayout {
        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" }
    }
}