summaryrefslogtreecommitdiffstats
path: root/examples/declarative/anchors/anchor-changes.qml
blob: 0c62791a516cd682832490b643e48d6ac18cbe84 (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
import Qt 4.6

Item {
    id: Window
    width: 200; height: 450

    Rectangle {
        id: Red; color: "Red"
        anchors.top: parent.top; height: 150
        width: parent.width
    }

    Rectangle {
        id: Orange; color: "Orange"
        anchors.top: Red.bottom; anchors.bottom: Green.top
        width: parent.width
    }

    Rectangle {
        id: Green; color: "Green"
        height: 150; anchors.bottom: parent.bottom
        width: parent.width
    }

    MouseRegion {
        anchors.fill: parent
        onPressed: Window.state = "Pressed"
        onReleased: Window.state = ""
    }

    states : State {
        name: "Pressed"
        PropertyChanges { target: Orange; color: "Yellow" }
        AnchorChanges { target: Orange; top: Window.top; bottom: Window.bottom }
    }
}