| 1 |
/* |
| 2 |
* Copyright 2013 Canonical Ltd. |
| 3 |
* |
| 4 |
* This program is free software; you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU Lesser General Public License as published by |
| 6 |
* the Free Software Foundation; version 3. |
| 7 |
* |
| 8 |
* This program is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
* GNU Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public License |
| 14 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
//![0] |
| 18 |
import QtQuick 2.4 |
| 19 |
import Lomiri.Components 1.2 |
| 20 |
import Lomiri.Layouts 1.0 |
| 21 |
|
| 22 |
Item { |
| 23 |
id: root |
| 24 |
width: units.gu(30) |
| 25 |
height: units.gu(30) |
| 26 |
|
| 27 |
Layouts { |
| 28 |
objectName: "layouts" |
| 29 |
id: layouts |
| 30 |
anchors.fill: parent |
| 31 |
|
| 32 |
layouts: [ |
| 33 |
//![row layout] |
| 34 |
ConditionalLayout { |
| 35 |
name: "row" |
| 36 |
when: layouts.width > units.gu(50) |
| 37 |
Row { |
| 38 |
anchors.fill: parent |
| 39 |
ItemLayout { |
| 40 |
item: "blue" |
| 41 |
width: units.gu(10) |
| 42 |
height: parent.height - units.gu(10) |
| 43 |
} |
| 44 |
ItemLayout { |
| 45 |
item: "red" |
| 46 |
width: parent.width / 3 |
| 47 |
anchors { |
| 48 |
top: parent.top |
| 49 |
bottom: parent.bottom |
| 50 |
} |
| 51 |
} |
| 52 |
ItemLayout { |
| 53 |
item: "green" |
| 54 |
width: parent.width / 3 |
| 55 |
anchors { |
| 56 |
top: parent.top |
| 57 |
bottom: parent.bottom |
| 58 |
} |
| 59 |
} |
| 60 |
} |
| 61 |
} |
| 62 |
//![row layout] |
| 63 |
] |
| 64 |
//![default layout] |
| 65 |
Button { |
| 66 |
id: redButton |
| 67 |
text: "Item #1" |
| 68 |
color: "red" |
| 69 |
Layouts.item: "red" |
| 70 |
anchors { |
| 71 |
left: parent.left |
| 72 |
top: parent.top |
| 73 |
bottom: parent.bottom |
| 74 |
} |
| 75 |
width: units.gu(15) |
| 76 |
} |
| 77 |
Button { |
| 78 |
id: greenButton |
| 79 |
text: "Item #2" |
| 80 |
color: "green" |
| 81 |
Layouts.item: "green" |
| 82 |
anchors { |
| 83 |
top: parent.top |
| 84 |
left: redButton.right |
| 85 |
right: parent.right |
| 86 |
} |
| 87 |
height: units.gu(10) |
| 88 |
} |
| 89 |
Button { |
| 90 |
id: blueButton |
| 91 |
text: "Item #3" |
| 92 |
color: "blue" |
| 93 |
Layouts.item: "blue" |
| 94 |
anchors{ |
| 95 |
left: redButton.right |
| 96 |
right: parent.right |
| 97 |
bottom: parent.bottom |
| 98 |
} |
| 99 |
height: units.gu(10) |
| 100 |
} |
| 101 |
//![default layout] |
| 102 |
} |
| 103 |
} |
| 104 |
//![0] |