summaryrefslogtreecommitdiffstats
path: root/examples/declarative/layouts/graphicsLayouts/graphicslayouts.qml
blob: fcd78d5784d7a6bc50b3de1cf8e102d1fdf50e16 (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
import Qt 4.7
import GraphicsLayouts 4.7

Item {
    id: resizable

    width: 800
    height: 400

    QGraphicsWidget {
        size.width: parent.width/2
        size.height: parent.height

        layout: QGraphicsLinearLayout {
            LayoutItem {
                minimumSize: "100x100"
                maximumSize: "300x300"
                preferredSize: "100x100"
                Rectangle { color: "yellow"; anchors.fill: parent }
            }
            LayoutItem {
                minimumSize: "100x100"
                maximumSize: "400x400"
                preferredSize: "200x200"
                Rectangle { color: "green"; anchors.fill: parent }
            }
        }
    }
    QGraphicsWidget {
        x: parent.width/2
        size.width: parent.width/2
        size.height: parent.height

        layout: QGraphicsGridLayout {
            LayoutItem {
                QGraphicsGridLayout.row: 0
                QGraphicsGridLayout.column: 0
                minimumSize: "100x100"
                maximumSize: "300x300"
                preferredSize: "100x100"
                Rectangle { color: "red"; anchors.fill: parent }
            }
            LayoutItem {
                QGraphicsGridLayout.row: 1
                QGraphicsGridLayout.column: 0
                minimumSize: "100x100"
                maximumSize: "200x200"
                preferredSize: "100x100"
                Rectangle { color: "orange"; anchors.fill: parent }
            }
            LayoutItem {
                QGraphicsGridLayout.row: 2
                QGraphicsGridLayout.column: 0
                minimumSize: "100x100"
                maximumSize: "300x300"
                preferredSize: "200x200"
                Rectangle { color: "yellow"; anchors.fill: parent }
            }
            LayoutItem {
                QGraphicsGridLayout.row: 0
                QGraphicsGridLayout.column: 1
                minimumSize: "100x100"
                maximumSize: "200x200"
                preferredSize: "200x200"
                Rectangle { color: "green"; anchors.fill: parent }
            }
            LayoutItem {
                QGraphicsGridLayout.row: 1
                QGraphicsGridLayout.column: 1
                minimumSize: "100x100"
                maximumSize: "400x400"
                preferredSize: "200x200"
                Rectangle { color: "blue"; anchors.fill: parent }
            }
        }
    }
}