diff --git a/examples/basiclayouts/main.qml b/examples/basiclayouts/main.qml index 475677dd325d9c5fc6726e2dfa18eb7c51054e93..374646d4ebb55a5b084bfff39fcd6e6a78de38dc 100644 --- a/examples/basiclayouts/main.qml +++ b/examples/basiclayouts/main.qml @@ -63,7 +63,7 @@ ApplicationWindow { id: rowBox title: "Row layout" - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true RowLayout { id: rowLayout spacing: 6 @@ -85,7 +85,7 @@ ApplicationWindow { GroupBox { id: gridBox title: "Grid layout" - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true GridLayout { id: gridLayout horizontalSpacing: 6 @@ -122,8 +122,8 @@ ApplicationWindow { Layout.row: 0 Layout.column: 2 Layout.rowSpan: 3 - Layout.verticalSizePolicy: Layout.Expanding - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillHeight: true + Layout.fillWidth: true } } } @@ -132,8 +132,8 @@ ApplicationWindow { placeholderText: "This is a placeholder for a TextField" width: 200 height: 400 - Layout.verticalSizePolicy: Layout.Expanding - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillHeight: true + Layout.fillWidth: true } } } diff --git a/examples/splitters/main.qml b/examples/splitters/main.qml index 1df39a82374271b335afda2f0be145ac2fab0356..f035e64487bc672aabd95550a208b93c70bff987 100644 --- a/examples/splitters/main.qml +++ b/examples/splitters/main.qml @@ -71,7 +71,7 @@ ApplicationWindow { SplitView { orientation: Qt.Vertical - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true Rectangle { id: row1 diff --git a/examples/text/qml/main.qml b/examples/text/qml/main.qml index bb52c6affae51e7ed787f1128b452b6863fa6e0b..a1a5c485792ef2e70934659da8f5c60d09a6c6ed 100644 --- a/examples/text/qml/main.qml +++ b/examples/text/qml/main.qml @@ -217,7 +217,7 @@ ApplicationWindow { ToolButton { action: alignCenter } ToolButton { action: alignRight } ToolButton { action: alignJustify } - Item { Layout.horizontalSizePolicy: Layout.Expanding } + Item { Layout.fillWidth: true } } } ToolBar { @@ -233,7 +233,7 @@ ApplicationWindow { currentIndex: document.defaultFontSizes.indexOf(document.fontSize + "") } TextField { id: fontEdit; enabled: false } - Item { Layout.horizontalSizePolicy: Layout.Expanding } + Item { Layout.fillWidth: true } } } diff --git a/src/controls/SplitView.qml b/src/controls/SplitView.qml index 39b7d77332b5b719e7c4a367daf6c0e54527a32c..64a9430af5e6350a5aa80b6479023b04639c6e6e 100644 --- a/src/controls/SplitView.qml +++ b/src/controls/SplitView.qml @@ -57,7 +57,7 @@ import QtQuick.Controls.Private 1.0 as Private Being expanding means that the item will get all the remaining space when other items have been laid out according to their own width and height. By default, the last visible child of the SplitView will be expanding, but - this can be changed by setting Layout.horizontalSizePolicy to \c Layout.Expanding. + this can be changed by setting Layout.fillWidth to \c true. Since the expanding item will automatically be resized to fit the extra space, it will ignore explicit assignments to width and height. @@ -69,7 +69,7 @@ import QtQuick.Controls.Private 1.0 as Private SplitView supports setting attached Layout properties on child items, which means that you can control minimumWidth, minimumHeight, maximumWidth and maximumHeight (in addition - to horizontalSizePolicy/verticalSizePolicy) for each child. + to fillWidth/fillHeight) for each child. Example: @@ -89,7 +89,7 @@ import QtQuick.Controls.Private 1.0 as Private Rectangle { id: centerItem Layout.minimumWidth: 50 - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true color: "darkgray" } Rectangle { @@ -182,8 +182,8 @@ Item { item.Layout.maximumHeightChanged.connect(d.updateLayout) item.Layout.minimumHeightChanged.connect(d.updateLayout) item.visibleChanged.connect(d.updateExpandingIndex) - item.Layout.horizontalSizePolicyChanged.connect(d.updateExpandingIndex) - item.Layout.verticalSizePolicyChanged.connect(d.updateExpandingIndex) + item.Layout.fillWidthChanged.connect(d.updateExpandingIndex) + item.Layout.fillHeightChanged.connect(d.updateExpandingIndex) } d.updateLayoutGuard = false @@ -194,9 +194,9 @@ Item { { if (!lastItem.visible) return - var policy = (root.orientation === Qt.Horizontal) ? "horizontalSizePolicy" : "verticalSizePolicy" + var policy = (root.orientation === Qt.Horizontal) ? "fillWidth" : "fillHeight" for (var i=0; i<__items.length-1; ++i) { - if (__items[i].Layout[policy] === Layout.Expanding) + if (__items[i].Layout[policy] === true) break; } @@ -410,8 +410,8 @@ Item { for (var i=0; i<splitterItems.children.length; ++i) { var item = splitterItems.children[i]; item.visibleChanged.disconnect(d.updateExpandingIndex) - item.Layout.horizontalSizePolicyChanged.disconnect(d.updateExpandingIndex) - item.Layout.verticalSizePolicyChanged.disconnect(d.updateExpandingIndex) + item.Layout.fillWidthChanged.disconnect(d.updateExpandingIndex) + item.Layout.fillHeightChanged.disconnect(d.updateExpandingIndex) } } } diff --git a/src/layouts/qquickgridlayoutengine_p.h b/src/layouts/qquickgridlayoutengine_p.h index 9a71f4c836a29064d5eed51970dc3485419204e9..dd26b1d688a72d920a64a216df431df3139e70bf 100644 --- a/src/layouts/qquickgridlayoutengine_p.h +++ b/src/layouts/qquickgridlayoutengine_p.h @@ -186,7 +186,7 @@ public: PREF | Layout.preferredWidth | implicitWidth | width MAX | Layout.maximumWidth | | 100000 -----+--------------------------------+-------------------+-------- -SizePolicy | Layout.horizontalSizePolicy | Expanding if layout, Fixed if item | + Fixed | Layout.fillWidth | Expanding if layout, Fixed if item | */ //--- GATHER MINIMUM SIZE HINTS --- @@ -276,22 +276,22 @@ prefS [1, 2, 3] [1, 3, 3] [1, 1, 3] [2, 3, 3] [2, 2, 3] [1, 1, 3] ###No chan sizeHintCacheDirty = true; } - - static QLayoutPolicy::Policy fromSizePolicy(QQuickLayout::SizePolicy policy) { - return (policy == QQuickLayout::Fixed ? QLayoutPolicy::Fixed : QLayoutPolicy::Preferred); - } - QLayoutPolicy::Policy sizePolicy(Qt::Orientation orientation) const { + bool fillExtent = false; + bool isSet = false; if (QQuickLayoutAttached *info = attachedLayoutObject(m_item, false)) { - QQuickLayout::SizePolicy sp = (orientation == Qt::Horizontal - ? info->horizontalSizePolicy() - : info->verticalSizePolicy()); - if (sp != QQuickLayout::Unspecified) - return fromSizePolicy(sp); + if (orientation == Qt::Horizontal) { + isSet = info->isFillWidthSet(); + if (isSet) fillExtent = info->fillWidth(); + } else { + isSet = info->isFillHeightSet(); + if (isSet) fillExtent = info->fillHeight(); + } } - // ### Correct way is to, go through all child items and combine the policies. - return qobject_cast<QQuickLayout*>(m_item) ? QLayoutPolicy::Preferred : QLayoutPolicy::Fixed; + if (!isSet && qobject_cast<QQuickLayout*>(m_item)) + fillExtent = true; + return fillExtent ? QLayoutPolicy::Preferred : QLayoutPolicy::Fixed; } void setGeometry(const QRectF &rect) diff --git a/src/layouts/qquicklayout.cpp b/src/layouts/qquicklayout.cpp index 7c5e173a86fc54a838cf02a7310d8b2f4664c45f..77c3d4431d1fea03e879fba08a843b384b199873 100644 --- a/src/layouts/qquicklayout.cpp +++ b/src/layouts/qquicklayout.cpp @@ -54,12 +54,14 @@ QQuickLayoutAttached::QQuickLayoutAttached(QObject *parent) m_preferredHeight(0), m_maximumWidth(q_declarativeLayoutMaxSize), m_maximumHeight(q_declarativeLayoutMaxSize), - m_verticalSizePolicy(QQuickLayout::Unspecified), - m_horizontalSizePolicy(QQuickLayout::Unspecified), m_row(0), m_column(0), m_rowSpan(1), m_columnSpan(1), + m_fillWidth(false), + m_fillHeight(false), + m_isFillWidthSet(false), + m_isFillHeightSet(false), m_changesNotificationEnabled(true) { @@ -127,21 +129,23 @@ void QQuickLayoutAttached::setMaximumHeight(qreal height) emit maximumHeightChanged(); } -void QQuickLayoutAttached::setVerticalSizePolicy(QQuickLayout::SizePolicy policy) +void QQuickLayoutAttached::setFillWidth(bool fill) { - if (m_verticalSizePolicy != policy) { - m_verticalSizePolicy = policy; + m_isFillWidthSet = true; + if (m_fillWidth != fill) { + m_fillWidth = fill; invalidateItem(); - emit verticalSizePolicyChanged(); + emit fillWidthChanged(); } } -void QQuickLayoutAttached::setHorizontalSizePolicy(QQuickLayout::SizePolicy policy) +void QQuickLayoutAttached::setFillHeight(bool fill) { - if (m_horizontalSizePolicy != policy) { - m_horizontalSizePolicy = policy; + m_isFillHeightSet = true; + if (m_fillHeight != fill) { + m_fillHeight = fill; invalidateItem(); - emit horizontalSizePolicyChanged(); + emit fillHeightChanged(); } } diff --git a/src/layouts/qquicklayout_p.h b/src/layouts/qquicklayout_p.h index 17e2b1ff4be83de2bc7be5329a93fc73b3c286b0..ad1f2df585e08699415a15e7e8c2ebfe3cca99c9 100644 --- a/src/layouts/qquicklayout_p.h +++ b/src/layouts/qquicklayout_p.h @@ -62,14 +62,7 @@ class QQuickLayoutPrivate; class QQuickLayout : public QQuickItem { Q_OBJECT - Q_ENUMS(SizePolicy) public: - enum SizePolicy { - Unspecified = 0, - Fixed, - Expanding - }; - enum SizeHint { MinimumSize = 0, PreferredSize, @@ -121,8 +114,8 @@ class QQuickLayoutAttached : public QObject Q_PROPERTY(qreal preferredHeight READ preferredHeight WRITE setPreferredHeight NOTIFY preferredHeightChanged) Q_PROPERTY(qreal maximumWidth READ maximumWidth WRITE setMaximumWidth NOTIFY maximumWidthChanged) Q_PROPERTY(qreal maximumHeight READ maximumHeight WRITE setMaximumHeight NOTIFY maximumHeightChanged) - Q_PROPERTY(QQuickLayout::SizePolicy verticalSizePolicy READ verticalSizePolicy WRITE setVerticalSizePolicy) - Q_PROPERTY(QQuickLayout::SizePolicy horizontalSizePolicy READ horizontalSizePolicy WRITE setHorizontalSizePolicy) + Q_PROPERTY(bool fillHeight READ fillHeight WRITE setFillHeight) + Q_PROPERTY(bool fillWidth READ fillWidth WRITE setFillWidth) Q_PROPERTY(int row READ row WRITE setRow) Q_PROPERTY(int column READ column WRITE setColumn) Q_PROPERTY(int rowSpan READ rowSpan WRITE setRowSpan) @@ -149,11 +142,13 @@ public: qreal maximumHeight() const { return m_maximumHeight; } void setMaximumHeight(qreal height); - QQuickLayout::SizePolicy verticalSizePolicy() const { return m_verticalSizePolicy; } - void setVerticalSizePolicy(QQuickLayout::SizePolicy policy); + bool fillWidth() const { return m_fillWidth; } + void setFillWidth(bool fill); + bool isFillWidthSet() const { return m_isFillWidthSet; } - QQuickLayout::SizePolicy horizontalSizePolicy() const { return m_horizontalSizePolicy; } - void setHorizontalSizePolicy(QQuickLayout::SizePolicy policy); + bool fillHeight() const { return m_fillHeight; } + void setFillHeight(bool fill); + bool isFillHeightSet() const { return m_isFillHeightSet; } int row() const { return m_row; } void setRow(int row) { m_row = row; } @@ -179,8 +174,8 @@ signals: void preferredHeightChanged(); void maximumWidthChanged(); void maximumHeightChanged(); - void verticalSizePolicyChanged(); - void horizontalSizePolicyChanged(); + void fillWidthChanged(); + void fillHeightChanged(); private: void invalidateItem(); @@ -193,8 +188,6 @@ private: qreal m_preferredHeight; qreal m_maximumWidth; qreal m_maximumHeight; - QQuickLayout::SizePolicy m_verticalSizePolicy; - QQuickLayout::SizePolicy m_horizontalSizePolicy; // GridLayout specific properties int m_row; @@ -202,8 +195,11 @@ private: int m_rowSpan; int m_columnSpan; - bool m_changesNotificationEnabled; - + unsigned m_fillWidth : 1; + unsigned m_fillHeight : 1; + unsigned m_isFillWidthSet : 1; + unsigned m_isFillHeightSet : 1; + unsigned m_changesNotificationEnabled : 1; friend class QQuickLayout; }; diff --git a/tests/auto/controls/data/tst_rowlayout.qml b/tests/auto/controls/data/tst_rowlayout.qml index a590b91652aa9d01c631e5b94c5612c635153c29..63892d857a94f8ecadb6efcc505dd5a5ac0e8fb0 100644 --- a/tests/auto/controls/data/tst_rowlayout.qml +++ b/tests/auto/controls/data/tst_rowlayout.qml @@ -66,7 +66,7 @@ Item { width: 5; \ height: 10; \ color: "#8080ff"; \ - Layout.horizontalSizePolicy: Layout.Fixed \ + Layout.fillWidth: false \ } \ property alias r2: _r2; \ Rectangle { \ @@ -74,7 +74,7 @@ Item { width: 10; \ height: 20; \ color: "#c0c0ff"; \ - Layout.horizontalSizePolicy: Layout.Expanding \ + Layout.fillWidth: true \ } \ } ' @@ -103,7 +103,7 @@ Item { width: 5; \ height: 10; \ color: "#8080ff"; \ - Layout.horizontalSizePolicy: Layout.Expanding \ + Layout.fillWidth: true \ } \ property alias r2: _r2; \ Rectangle { \ @@ -111,7 +111,7 @@ Item { width: 10; \ height: 20; \ color: "#c0c0ff"; \ - Layout.horizontalSizePolicy: Layout.Expanding \ + Layout.fillWidth: true \ } \ } ' @@ -150,7 +150,7 @@ Item { color: "green"; \ implicitWidth: 50; \ implicitHeight: 20; \ - Layout.horizontalSizePolicy: Layout.Expanding; \ + Layout.fillWidth: true; \ } \ } \ } ' @@ -217,7 +217,7 @@ Item { implicitHeight: 20; \ property int counter : 0; \ onWidthChanged: { ++counter; } \ - Layout.horizontalSizePolicy: Layout.Expanding; \ + Layout.fillWidth: true; \ } \ Rectangle { \ id: _r2; \ @@ -226,7 +226,7 @@ Item { implicitHeight: 20; \ property int counter : 0; \ onWidthChanged: { ++counter; } \ - Layout.horizontalSizePolicy: Layout.Expanding; \ + Layout.fillWidth: true; \ } \ } \ } ' diff --git a/tests/manual/Layout.qml b/tests/manual/Layout.qml index 19374f62d3eeeb688790b3815b6d76ac674ac6e7..3577aa9d815dceea7acaed14ed1bf7a419600b34 100644 --- a/tests/manual/Layout.qml +++ b/tests/manual/Layout.qml @@ -159,7 +159,7 @@ Item { height: parent.height Layout.minimumWidth: 50 Layout.maximumWidth: 100 - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true } Rectangle { color: "green" @@ -167,14 +167,14 @@ Item { visible: !ckHideGreen.checked Layout.minimumWidth: 100 Layout.maximumWidth: 200 - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true } Rectangle { color: "blue" height: parent.height Layout.minimumWidth: 200 Layout.maximumWidth: 400 - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true } } @@ -190,20 +190,20 @@ Item { color: "red" height: parent.height Layout.minimumWidth: 100 - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true } Rectangle { color: "green" height: parent.height visible: !ckHideGreen.checked Layout.minimumWidth: 200 - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true } Rectangle { color: "blue" height: parent.height Layout.minimumWidth: 300 - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true } } @@ -219,7 +219,7 @@ Item { height: parent.height Layout.minimumWidth: 200 Layout.maximumWidth: 500 - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true } } @@ -238,13 +238,13 @@ Item { color: "red" height: parent.height Layout.minimumWidth: 100 - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true } Rectangle { color: "blue" height: parent.height Layout.minimumWidth: 200 - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true } } @@ -258,14 +258,14 @@ Item { width: 40 visible: !ckHideGreen.checked Layout.maximumWidth: 300 - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true } Rectangle { color: "red" height: parent.height Layout.minimumWidth: 40 Layout.maximumWidth: 100 - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true } } } @@ -354,7 +354,7 @@ Item { height: 60 Layout.minimumHeight: 50 Layout.maximumHeight: 100 - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillHeight: true } Rectangle { color: "green" @@ -363,14 +363,14 @@ Item { visible: !ckHideGreen.checked Layout.minimumHeight: 75 Layout.maximumHeight: 125 - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillHeight: true } Rectangle { color: "blue" width: parent.width height: 120 Layout.minimumHeight: 100 - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillHeight: true } } @@ -385,20 +385,20 @@ Item { color: "red" width: parent.width Layout.minimumHeight: 100 - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillHeight: true } Rectangle { color: "green" width: parent.width visible: !ckHideGreen.checked Layout.minimumHeight: 200 - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillHeight: true } Rectangle { color: "blue" width: parent.width Layout.minimumHeight: 300 - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillHeight: true } } @@ -412,20 +412,20 @@ Item { ColumnLayout { spacing: 10 width: parent.width - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillHeight: true Rectangle { color: "red" width: parent.width Layout.minimumHeight: 100 Layout.maximumHeight: 300 - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillHeight: true } Rectangle { color: "blue" width: parent.width Layout.minimumHeight: 100 - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillHeight: true Layout.maximumHeight: 200 } } @@ -434,21 +434,21 @@ Item { spacing: 10 width: parent.width Layout.maximumHeight: 200 - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillHeight: true Rectangle { color: "green" width: parent.width height: 50 visible: !ckHideGreen.checked Layout.maximumHeight: 300 - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillHeight: true } Rectangle { color: "red" width: parent.width height: 50 Layout.minimumHeight: 40 - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillHeight: true } } } @@ -472,7 +472,7 @@ Item { Rectangle { color: "red" height: parent.height - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true } Rectangle { color: "green" @@ -483,7 +483,7 @@ Item { Rectangle { color: "blue" height: parent.height - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true } } @@ -495,8 +495,8 @@ Item { anchors.right: parent.right Layout.minimumHeight: 10 Layout.maximumHeight: 30 - Layout.horizontalSizePolicy: Layout.Expanding - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillWidth: true + Layout.fillHeight: true } // [3] @@ -509,7 +509,7 @@ Item { color: "red" height: parent.height Layout.maximumHeight: 200 - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true } Rectangle { color: "blue" @@ -527,7 +527,7 @@ Item { anchors.right: parent.right Layout.minimumHeight: 100 Layout.maximumHeight: 200 - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillHeight: true } Rectangle { @@ -535,7 +535,7 @@ Item { height: parent.height anchors.left: parent.left anchors.right: parent.right - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillHeight: true } } } @@ -570,8 +570,8 @@ Item { height: 52 Layout.row: 0 Layout.column: 0 - Layout.horizontalSizePolicy: Layout.Expanding - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillWidth: true + Layout.fillHeight: true } Rectangle { color: "white" @@ -579,8 +579,8 @@ Item { height: 52 Layout.row: 0 Layout.column: 1 - Layout.horizontalSizePolicy: Layout.Expanding - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillWidth: true + Layout.fillHeight: true } Rectangle { color: "blue" @@ -589,8 +589,8 @@ Item { Layout.row: 0 Layout.column: 2 Layout.rowSpan: 2 - Layout.horizontalSizePolicy: Layout.Expanding - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillWidth: true + Layout.fillHeight: true } Rectangle { color: "white" @@ -598,8 +598,8 @@ Item { height: 52 Layout.row: 0 Layout.column: 3 - Layout.horizontalSizePolicy: Layout.Expanding - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillWidth: true + Layout.fillHeight: true } Rectangle { color: "red" @@ -607,8 +607,8 @@ Item { height: 52 Layout.row: 0 Layout.column: 4 - Layout.horizontalSizePolicy: Layout.Expanding - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillWidth: true + Layout.fillHeight: true } // row 1 @@ -619,8 +619,8 @@ Item { Layout.row: 1 Layout.column: 0 Layout.columnSpan: 2 - Layout.horizontalSizePolicy: Layout.Expanding - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillWidth: true + Layout.fillHeight: true } Rectangle { color: "white" @@ -629,8 +629,8 @@ Item { Layout.row: 1 Layout.column: 3 Layout.columnSpan: 2 - Layout.horizontalSizePolicy: Layout.Expanding - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillWidth: true + Layout.fillHeight: true } // row 2 @@ -641,8 +641,8 @@ Item { Layout.row: 2 Layout.column: 0 Layout.columnSpan: 5 - Layout.horizontalSizePolicy: Layout.Expanding - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillWidth: true + Layout.fillHeight: true } // row 3 @@ -653,8 +653,8 @@ Item { Layout.row: 3 Layout.column: 0 Layout.columnSpan: 2 - Layout.horizontalSizePolicy: Layout.Expanding - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillWidth: true + Layout.fillHeight: true } Rectangle { color: "blue" @@ -663,8 +663,8 @@ Item { Layout.row: 3 Layout.column: 2 Layout.rowSpan: 2 - Layout.horizontalSizePolicy: Layout.Expanding - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillWidth: true + Layout.fillHeight: true } Rectangle { color: "white" @@ -673,8 +673,8 @@ Item { Layout.row: 3 Layout.column: 3 Layout.columnSpan: 2 - Layout.horizontalSizePolicy: Layout.Expanding - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillWidth: true + Layout.fillHeight: true } // row 4 @@ -684,8 +684,8 @@ Item { height: 52 Layout.row: 4 Layout.column: 0 - Layout.horizontalSizePolicy: Layout.Expanding - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillWidth: true + Layout.fillHeight: true } Rectangle { color: "white" @@ -693,8 +693,8 @@ Item { height: 52 Layout.row: 4 Layout.column: 1 - Layout.horizontalSizePolicy: Layout.Expanding - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillWidth: true + Layout.fillHeight: true } Rectangle { color: "white" @@ -702,8 +702,8 @@ Item { height: 52 Layout.row: 4 Layout.column: 3 - Layout.horizontalSizePolicy: Layout.Expanding - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillWidth: true + Layout.fillHeight: true } Rectangle { color: "red" @@ -711,8 +711,8 @@ Item { height: 52 Layout.row: 4 Layout.column: 4 - Layout.horizontalSizePolicy: Layout.Expanding - Layout.verticalSizePolicy: Layout.Expanding + Layout.fillWidth: true + Layout.fillHeight: true } } diff --git a/tests/manual/scrollview/main.qml b/tests/manual/scrollview/main.qml index cb26763f32cd8c455fd9311c3dc945891b2d76c8..cc7b967dae2a1f4436a69572354938963f4c0d0b 100644 --- a/tests/manual/scrollview/main.qml +++ b/tests/manual/scrollview/main.qml @@ -78,7 +78,7 @@ ApplicationWindow { value: 1000 implicitWidth: 80 } - Item { Layout.horizontalSizePolicy: Layout.Expanding } + Item { Layout.fillWidth: true } } } diff --git a/tests/manual/testbench/content/PropertyLayouts.qml b/tests/manual/testbench/content/PropertyLayouts.qml index c79771a4adcf1d1c5842c2715866e502e3bda94e..05061fcc59835f258c018eb57c5561872220daa7 100644 --- a/tests/manual/testbench/content/PropertyLayouts.qml +++ b/tests/manual/testbench/content/PropertyLayouts.qml @@ -64,7 +64,7 @@ QtObject { value: result maximumValue: 9999 minimumValue: -9999 - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true onValueChanged: { if (!ignoreUpdate) { loader.item[name] = value @@ -87,7 +87,7 @@ QtObject { stepSize: 0.5 maximumValue: 9999 minimumValue: -9999 - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true onValueChanged: { if (!ignoreUpdate) { loader.item[name] = value @@ -114,7 +114,7 @@ QtObject { TextField { id: tf text: result - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true onTextChanged: { if (!ignoreUpdate) { loader.item[name] = tf.text @@ -134,7 +134,7 @@ QtObject { Label { height: 20 anchors.right: parent.right - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true text: loader.item[name] !== undefined ? loader.item[name] : "" } } diff --git a/tests/manual/testbench/main.qml b/tests/manual/testbench/main.qml index 7454a121a33bdfb1015d5a35314d5c25c9c72108..afe2e3abb7a6ed0343b51d0d91f5bc425fd2dae6 100644 --- a/tests/manual/testbench/main.qml +++ b/tests/manual/testbench/main.qml @@ -108,7 +108,7 @@ ApplicationWindow { Flickable { id: testBenchRect clip: true - Layout.horizontalSizePolicy: Layout.Expanding + Layout.fillWidth: true Image { anchors.fill: parent