Debian Codegraph @

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

raw
1 import QtQuick 2.0
2
3 // positioning done with bindings
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: p.width
14 height: p.height / 2
15 y: p.height / 2
16
17 Rectangle {
18 id: n1
19 color: "green"
20 width: c.width / 2
21 height: c.height / 4
22 x: 0
23 y: c.height / 2
24 }
25
26 Rectangle {
27 id: n2
28 color: "cyan"
29 width: c.width / 2
30 height: c.height / 4
31 x: c.width / 2
32 y: c.height / 2
33 }
34
35 Rectangle {
36 id: n3
37 color: "aquamarine"
38 width: c.width / 2
39 height: c.height / 4
40 x: 0
41 y: (c.height / 4) * 3
42 }
43
44 Rectangle {
45 id: n4
46 color: "lightgreen"
47 width: c.width / 2
48 height: c.height / 4
49 x: c.width / 2
50 y: (c.height / 4) * 3
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 // p.height = 800;
64 // } else {
65 // count = 0;
66 // p.height = 400;
67 // }
68 // }
69 //}
70
71 Component.onCompleted: {
72 var iterations = 10000;
73 //var t0 = new Date();
74 while (iterations > 0) {
75 iterations--;
76 p.height = 800;
77 p.height = 400;
78 }
79 //var t1 = new Date();
80 //console.log("Binding Positioning: " + (t1.valueOf() - t0.valueOf()) + " milliseconds");
81 }
82 }