Debian Codegraph @

tests/benchmarks/qml/librarymetrics_performance/data/absolutepositioning.qml

raw
1 import QtQuick 2.0
2
3 // positioning all elements manually.
4 Rectangle {
5 id: p
6 color: "red"
7 width: 400
8 height: 800
9
10 Rectangle {
11 id: c
12 color: "blue"
13 width: 400
14 height: 400
15 y: 400
16
17 Rectangle {
18 id: n1
19 color: "green"
20 width: 200
21 height: 100
22 x: 0
23 y: 200
24 }
25
26 Rectangle {
27 id: n2
28 color: "cyan"
29 width: 200
30 height: 100
31 x: 200
32 y: 200
33 }
34
35 Rectangle {
36 id: n3
37 color: "aquamarine"
38 width: 200
39 height: 100
40 x: 0
41 y: 300
42 }
43
44 Rectangle {
45 id: n4
46 color: "lightgreen"
47 width: 200
48 height: 100
49 x: 200
50 y: 300
51 }
52 }
53
54 // for visually determining correctness.
55 //Timer {
56 // property int count: 0
57 // interval: 1000
58 // running: true
59 // repeat: true
60 // onTriggered: {
61 // if (count == 0) {
62 // count = 1;
63 // // expand
64 // p.height = 800
65 // c.height = 400
66 // c.y = 400
67 // n1.height = 100
68 // n1.y = 200
69 // n2.height = 100
70 // n2.y = 200
71 // n3.height = 100
72 // n3.y = 300
73 // n4.height = 100
74 // n4.y = 300
75 // } else {
76 // count = 0;
77 // // shrink
78 // p.height = 400
79 // c.height = 200
80 // c.y = 200
81 // n1.height = 50
82 // n1.y = 100
83 // n2.height = 50
84 // n2.y = 100
85 // n3.height = 50
86 // n3.y = 150
87 // n4.height = 50
88 // n4.y = 150
89 // }
90 // }
91 //}
92
93 Component.onCompleted: {
94 // expand
95 p.height = 800
96 c.height = 400
97 c.y = 400
98 n1.height = 100
99 n1.y = 200
100 n2.height = 100
101 n2.y = 200
102 n3.height = 100
103 n3.y = 300
104 n4.height = 100
105 n4.y = 300
106 // shrink
107 p.height = 400
108 c.height = 200
109 c.y = 200
110 n1.height = 50
111 n1.y = 100
112 n2.height = 50
113 n2.y = 100
114 n3.height = 50
115 n3.y = 150
116 n4.height = 50
117 n4.y = 150
118 }
119 }