summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@digia.com>2013-03-13 15:01:40 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-04 17:45:43 +0200
commit6758f510dc70551114366f8e76887a7d585290c4 (patch)
treeacc8178c600d1d4b51c8e06bd0e4d5436884778f /examples
parent0608949d4c2762db58fba65adfaa2b7be23cdba5 (diff)
downloadqtquickcontrols-6758f510dc70551114366f8e76887a7d585290c4.tar.gz
Add support for auto-positioning of items in a grid layout
Items will be laid sequentially in the grid, either in LeftToRight mode or TopToBottom mode (depending on the value of the flow property) Change-Id: Ib080517260ac4519171e77abd533cad3f306f70e Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/basiclayouts/main.qml67
1 files changed, 19 insertions, 48 deletions
diff --git a/examples/basiclayouts/main.qml b/examples/basiclayouts/main.qml
index d2b37204..fd107cc1 100644
--- a/examples/basiclayouts/main.qml
+++ b/examples/basiclayouts/main.qml
@@ -58,7 +58,6 @@ ApplicationWindow {
id: mainLayout
anchors.fill: parent
anchors.margins: margin
- spacing: 6
GroupBox {
id: rowBox
title: "Row layout"
@@ -68,22 +67,13 @@ ApplicationWindow {
RowLayout {
id: rowLayout
- spacing: 6
anchors.fill: parent
- Button {
- text: "Button 1"
- }
- Button {
- text: "Button 2"
- }
- Button {
- text: "Button 3"
+ TextField {
+ placeholderText: "This wants to grow horizontally"
+ Layout.fillWidth: true
}
Button {
- text: "Button 4"
- }
- Item {
- Layout.fillWidth: true
+ text: "Button"
}
}
}
@@ -97,49 +87,30 @@ ApplicationWindow {
GridLayout {
id: gridLayout
- rowSpacing: 6
- columnSpacing: 6
+ rows: 3
+ flow: GridLayout.TopToBottom
anchors.fill: parent
- Label {
- text: "Line 1"
- Layout.row: 0
- Layout.column: 0
- }
- Label {
- text: "Line 2"
- Layout.row: 1
- Layout.column: 0
- }
- Label {
- text: "Line 3"
- Layout.row: 2
- Layout.column: 0
- }
- TextField {
- Layout.row: 0
- Layout.column: 1
- }
- TextField {
- Layout.row: 1
- Layout.column: 1
- }
- TextField {
- Layout.row: 2
- Layout.column: 1
- }
+
+ Label { text: "Line 1" }
+ Label { text: "Line 2" }
+ Label { text: "Line 3" }
+
+ TextField { }
+ TextField { }
+ TextField { }
+
TextArea {
- text: "This widget spans over three rows in the grid layout"
- Layout.row: 0
- Layout.column: 2
+ text: "This widget spans over three rows in the GridLayout.\n"
+ + "All items in the GridLayout are implicitly positioned from top to bottom."
Layout.rowSpan: 3
Layout.fillHeight: true
Layout.fillWidth: true
}
}
}
- TextField {
+ TextArea {
id: t3
- placeholderText: "This is a placeholder for a TextField"
+ text: "This fills the whole cell"
width: 200
height: 400
Layout.fillHeight: true