diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2014-06-25 10:27:39 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@digia.com> | 2014-06-25 10:27:39 +0200 |
commit | 91caf7531476d16c1c7a6d22705cb36ac93c5ab7 (patch) | |
tree | e4f67bcd61c55ba2b8cb4a4d01b10f69837c74e8 /src/layouts | |
parent | 1f0def9e8feca180680c1344cef6cf250b7630ba (diff) | |
parent | 6b876b21cd23f2af879543edf773dac41b4d0e97 (diff) |
Merge remote-tracking branch 'origin/5.3' into dev
Conflicts:
.qmake.conf
src/controls/Styles/Desktop/SpinBoxStyle.qml
Change-Id: Ia501c1388a2af9f273ec2742abbfc766717ad9e6
Diffstat (limited to 'src/layouts')
-rw-r--r-- | src/layouts/doc/images/columnlayout.png | bin | 0 -> 348 bytes | |||
-rw-r--r-- | src/layouts/doc/images/gridlayout.png | bin | 0 -> 2530 bytes | |||
-rw-r--r-- | src/layouts/doc/images/rowlayout.png | bin | 0 -> 2627 bytes | |||
-rw-r--r-- | src/layouts/qquicklayout.cpp | 4 | ||||
-rw-r--r-- | src/layouts/qquicklinearlayout.cpp | 86 |
5 files changed, 79 insertions, 11 deletions
diff --git a/src/layouts/doc/images/columnlayout.png b/src/layouts/doc/images/columnlayout.png Binary files differnew file mode 100644 index 000000000..f03eb7b99 --- /dev/null +++ b/src/layouts/doc/images/columnlayout.png diff --git a/src/layouts/doc/images/gridlayout.png b/src/layouts/doc/images/gridlayout.png Binary files differnew file mode 100644 index 000000000..493813c48 --- /dev/null +++ b/src/layouts/doc/images/gridlayout.png diff --git a/src/layouts/doc/images/rowlayout.png b/src/layouts/doc/images/rowlayout.png Binary files differnew file mode 100644 index 000000000..519a62fdd --- /dev/null +++ b/src/layouts/doc/images/rowlayout.png diff --git a/src/layouts/qquicklayout.cpp b/src/layouts/qquicklayout.cpp index 27de432f3..f5d8c99f8 100644 --- a/src/layouts/qquicklayout.cpp +++ b/src/layouts/qquicklayout.cpp @@ -317,7 +317,7 @@ void QQuickLayoutAttached::setMaximumImplicitSize(const QSizeF &sz) If this property is \c true, the item will be as wide as possible while respecting the given constraints. If the property is \c false, the item will have a fixed width set to the preferred width. - The default is \c false, except for layouts themselves which defaults to \c true. + The default is \c false, except for layouts themselves, which default to \c true. \sa fillHeight */ @@ -337,7 +337,7 @@ void QQuickLayoutAttached::setFillWidth(bool fill) If this property is \c true, the item will be as tall as possible while respecting the given constraints. If the property is \c false, the item will have a fixed height set to the preferred height. - The default is \c false, except for layouts themselves which defaults to \c true. + The default is \c false, except for layouts themselves, which default to \c true. \sa fillWidth */ diff --git a/src/layouts/qquicklinearlayout.cpp b/src/layouts/qquicklinearlayout.cpp index ea772225a..2db7bee0e 100644 --- a/src/layouts/qquicklinearlayout.cpp +++ b/src/layouts/qquicklinearlayout.cpp @@ -69,6 +69,39 @@ \li \l{Layout::alignment}{Layout.alignment} \endlist + \image rowlayout.png + + \code + RowLayout { + id: layout + anchors.fill: parent + spacing: 6 + Rectangle { + color: 'teal' + Layout.fillWidth: true + Layout.minimumWidth: 50 + Layout.preferredWidth: 100 + Layout.maximumWidth: 300 + Layout.minimumHeight: 150 + Text { + anchors.centerIn: parent + text: parent.width + 'x' + parent.height + } + } + Rectangle { + color: 'plum' + Layout.fillWidth: true + Layout.minimumWidth: 100 + Layout.preferredWidth: 200 + Layout.preferredHeight: 100 + Text { + anchors.centerIn: parent + text: parent.width + 'x' + parent.height + } + } + } + \endcode + Read more about attached properties \l{QML Object Attributes}{here}. \sa ColumnLayout \sa GridLayout @@ -98,6 +131,36 @@ \li \l{Layout::alignment}{Layout.alignment} \endlist + \image columnlayout.png + + \code + ColumnLayout{ + spacing: 2 + + Rectangle { + Layout.alignment: Qt.AlignCenter + color: "red" + Layout.preferredWidth: 40 + Layout.preferredHeight: 40 + } + + Rectangle { + Layout.alignment: Qt.AlignRight + color: "green" + Layout.preferredWidth: 40 + Layout.preferredHeight: 70 + } + + Rectangle { + Layout.alignment: Qt.AlignBottom + Layout.fillHeight: true + color: "blue" + Layout.preferredWidth: 70 + Layout.preferredHeight: 40 + } + } + \endcode + Read more about attached properties \l{QML Object Attributes}{here}. \sa RowLayout @@ -114,6 +177,8 @@ \ingroup layouts \brief Provides a way of dynamically arranging items in a grid. + + If the GridLayout is resized, all items in the layout will be rearranged. It is similar to the widget-based QGridLayout. All visible children of the GridLayout element will belong to the layout. If you want a layout with just one row or one column, you can use the @@ -127,16 +192,19 @@ columns the layout can have, before the auto-positioning wraps back to the beginning of the next row. The \l columns property is only used when \l flow is \c GridLayout.LeftToRight. + \image gridlayout.png + \code - GridLayout { - id: grid - columns: 3 - Text { text: "Three" } - Text { text: "words" } - Text { text: "in" } - Text { text: "a" } - Text { text: "row" } - } + GridLayout { + id: grid + columns: 3 + + Text { text: "Three"; font.bold: true; } + Text { text: "words"; color: "red" } + Text { text: "in"; font.underline: true } + Text { text: "a"; font.pixelSize: 20 } + Text { text: "row"; font.strikeout: true } + } \endcode The \l rows property works in a similar way, but items are auto-positioned vertically. The \l |