Debian Codegraph @

tests/benchmarks/qml/librarymetrics_performance/data/anchoredpositioning.2.qml

raw
1 import QtQuick 2.0
2
3 // positioning via anchors
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 Rectangle {
19 id: g
20 anchors.top: c.verticalCenter
21 anchors.bottom: c.bottom
22 anchors.left: c.left
23 anchors.right: c.right
24
25 Rectangle {
26 id: n1
27 color: "green"
28 anchors.top: g.top
29 anchors.bottom: g.verticalCenter
30 anchors.left: g.left
31 anchors.right: g.horizontalCenter
32 }
33
34 Rectangle {
35 id: n2
36 color: "cyan"
37 anchors.top: g.top
38 anchors.bottom: g.verticalCenter
39 anchors.left: g.horizontalCenter
40 anchors.right: g.right
41 }
42
43 Rectangle {
44 id: n3
45 color: "aquamarine"
46 anchors.top: g.verticalCenter
47 anchors.bottom: g.bottom
48 anchors.left: g.left
49 anchors.right: g.horizontalCenter
50 }
51
52 Rectangle {
53 id: n4
54 color: "lightgreen"
55 anchors.top: g.verticalCenter
56 anchors.bottom: g.bottom
57 anchors.left: g.horizontalCenter
58 anchors.right: g.right
59 }
60 }
61 }
62
63 // for visually determining correctness.
64 //Timer {
65 // property int count: 0
66 // interval: 1000
67 // running: true
68 // repeat: true
69 // onTriggered: {
70 // if (count == 0) {
71 // count = 1;
72 // p.height = 800;
73 // } else {
74 // count = 0;
75 // p.height = 400;
76 // }
77 // }
78 //}
79
80 Component.onCompleted: {
81 var iterations = 10000;
82 //var t0 = new Date();
83 while (iterations > 0) {
84 iterations--;
85 p.height = 800;
86 p.height = 400;
87 }
88 //var t1 = new Date();
89 //console.log("Anchored Positioning: " + (t1.valueOf() - t0.valueOf()) + " milliseconds");
90 }
91 }