summaryrefslogtreecommitdiffstats
path: root/examples/declarative/tutorials/t3/tutorial3.qml
blob: 8e2b697863c9230f9f1aeea90378f1cca949e268 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Rect {
    id: Page
    width: 480
    height: 200
    color: "white"
    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
                SetProperty {
                    target: HelloText
                    property: "y"
                    value: 160
                }
                SetProperty {
                    target: HelloText
                    property: "color"
                    value: "red"
                }
            }
        ]
        transitions: [
            Transition {
                fromState: "*"
                toState: "down"
                reversible: true
                ParallelAnimation {
                    NumericAnimation {
                        properties: "y"
                        duration: 500
                        easing: "easeOutBounce"
                    }
                    ColorAnimation {
                        duration: 500
                    }
                }
            }
        ]
    }
    MouseRegion {
        id: MouseRegion
        anchors.fill: HelloText
    }
    GridLayout {
        id: ColorPicker
        x: 0
        anchors.bottom: Page.bottom
        width: 120
        height: 50
        columns: 3
        rows: 2
        Cell {
            color: "#ff0000"
        }
        Cell {
            color: "#00ff00"
        }
        Cell {
            color: "#0000ff"
        }
        Cell {
            color: "#ffff00"
        }
        Cell {
            color: "#00ffff"
        }
        Cell {
            color: "#ff00ff"
        }
    }
}