tests/benchmarks/qml/librarymetrics_performance/data/bindingwithgridpositioning.qml
raw| 1 | import QtQuick 2.0 |
| 2 | |
| 3 | // positioning via bindings 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 | width: p.width |
| 14 | height: p.height / 2 |
| 15 | y: p.height / 2 |
| 16 | |
| 17 | Grid { |
| 18 | id: g |
| 19 | rows: 2 |
| 20 | columns: 2 |
| 21 | width: c.width |
| 22 | height: c.height / 2 |
| 23 | y: c.height / 2 |
| 24 | |
| 25 | Rectangle { |
| 26 | id: n1 |
| 27 | color: "green" |
| 28 | width: g.width/2 |
| 29 | height: g.height/2 |
| 30 | } |
| 31 | |
| 32 | Rectangle { |
| 33 | id: n2 |
| 34 | color: "cyan" |
| 35 | width: g.width/2 |
| 36 | height: g.height/2 |
| 37 | } |
| 38 | |
| 39 | Rectangle { |
| 40 | id: n3 |
| 41 | color: "aquamarine" |
| 42 | width: g.width/2 |
| 43 | height: g.height/2 |
| 44 | } |
| 45 | |
| 46 | Rectangle { |
| 47 | id: n4 |
| 48 | color: "lightgreen" |
| 49 | width: g.width/2 |
| 50 | height: g.height/2 |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | // for visually determining correctness. |
| 56 | //Timer { |
| 57 | // property int count: 0 |
| 58 | // interval: 1000 |
| 59 | // running: true |
| 60 | // repeat: true |
| 61 | // onTriggered: { |
| 62 | // if (count == 0) { |
| 63 | // count = 1; |
| 64 | // p.height = 800; |
| 65 | // } else { |
| 66 | // count = 0; |
| 67 | // p.height = 400; |
| 68 | // } |
| 69 | // } |
| 70 | //} |
| 71 | |
| 72 | Component.onCompleted: { |
| 73 | p.height = 800; |
| 74 | p.height = 400; |
| 75 | } |
| 76 | } |