Debian Codegraph @

tests/benchmarks/qml/librarymetrics_performance/data/anchorwithgridpositioning.qml

raw
1 import QtQuick 2.0
2
3 // positioning via anchors with a grid
4 Rectangle {
5 id: p
6 color: "red"
7 width: 400
8 height: 800
9
10 Rectangle {
11 id: c
12 color: "blue"
13 anchors.top: p.verticalCenter
14 anchors.bottom: p.bottom
15 anchors.left: p.left
16 anchors.right: p.right
17
18 Grid {
19 id: g
20 rows: 2
21 columns: 2
22 anchors.top: c.verticalCenter
23 anchors.bottom: c.bottom
24 anchors.left: c.left
25 anchors.right: c.right
26
27 Rectangle {
28 id: n1
29 color: "green"
30 anchors.top: g.top
31 anchors.bottom: g.verticalCenter
32 anchors.left: g.left
33 anchors.right: g.horizontalCenter
34 }
35
36 Rectangle {
37 id: n2
38 color: "cyan"
39 anchors.top: g.top
40 anchors.bottom: g.verticalCenter
41 anchors.left: g.horizontalCenter
42 anchors.right: g.right
43 }
44
45 Rectangle {
46 id: n3
47 color: "aquamarine"
48 anchors.top: g.verticalCenter
49 anchors.bottom: g.bottom
50 anchors.left: g.left
51 anchors.right: g.horizontalCenter
52 }
53
54 Rectangle {
55 id: n4
56 color: "lightgreen"
57 anchors.top: g.verticalCenter
58 anchors.bottom: g.bottom
59 anchors.left: g.horizontalCenter
60 anchors.right: g.right
61 }
62 }
63 }
64
65 // for visually determining correctness.
66 //Timer {
67 // property int count: 0
68 // interval: 1000
69 // running: true
70 // repeat: true
71 // onTriggered: {
72 // if (count == 0) {
73 // count = 1;
74 // p.height = 800;
75 // } else {
76 // count = 0;
77 // p.height = 400;
78 // }
79 // }
80 //}
81
82 Component.onCompleted: {
83 p.height = 800;
84 p.height = 400;
85 }
86 }