summaryrefslogtreecommitdiffstats
path: root/examples/declarative/positioners/mirroring-positioners.qml
blob: 0db95ddec27df9081b8d8fd2467841e606af78a7 (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
import QtQuick 1.0

Rectangle {
    width: column.width+10
    height: column.height+10
    property bool arabic: false
    Column {
        id: column
        spacing: 10
        anchors.centerIn: parent
        Text {
            text: "Row"
            anchors.horizontalCenter: parent.horizontalCenter
        }
        Row {
            flow: arabic ? Row.RightToLeft : Row.LeftToRight
            spacing: 10
            Repeater {
                model: 4
                Loader {
                    property int value: index
                    sourceComponent: delegate
                }
            }
        }
        Text {
            text: "Grid"
            anchors.horizontalCenter: parent.horizontalCenter
        }
        Grid {
            flow: arabic ? Grid.RightToLeft : Grid.LeftToRight
            spacing: 10; columns: 4
            Repeater {
                model: 11
                Loader {
                    property int value: index
                    sourceComponent: delegate
                }
            }
        }
        Rectangle {
            height: 50; width: parent.width
            color: mouseArea.pressed ? "black" : "gray"
            Text {
                text: arabic ? "RTL" : "LTR"
                color: "white"
                font.pixelSize: 20
                anchors.centerIn: parent
            }
            MouseArea {
                id: mouseArea
                onClicked: arabic = !arabic
                anchors.fill: parent
            }
        }
    }
    Component {
        id: delegate
        Rectangle {
            width: 50; height: 50
            color: Qt.rgba(0.8/(parent.value+1),0.8/(parent.value+1),0.8/(parent.value+1),1.0)
            Text {
                text: parent.parent.value+1
                color: "white"
                font.pixelSize: 20
                anchors.centerIn: parent
            }
        }
    }
}