summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Arve Sæther <jan-arve.saether@qt.io>2023-05-10 10:23:52 +0200
committerJan Arve Sæther <jan-arve.saether@qt.io>2023-05-11 11:57:13 +0200
commit1257e1d3b264a2a358408b2bf8ad3814bdf7c1aa (patch)
tree9e53bd9ff20a82ffa134765df357e2d0fdf46323
parent3a00b23e4a3cde92f9a453c9ff47d8e02932ad13 (diff)
downloadqtdeclarative-1257e1d3b264a2a358408b2bf8ad3814bdf7c1aa.tar.gz
Allow a layout with width or height == 0 to resize its child items
Fixes: QTBUG-112740 Pick-to: 6.5 Change-Id: I66327f3fa76d3f1c14b62d0ac42d3fd4c28288b2 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--src/quicklayouts/qquicklayout.cpp2
-rw-r--r--tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml12
2 files changed, 12 insertions, 2 deletions
diff --git a/src/quicklayouts/qquicklayout.cpp b/src/quicklayouts/qquicklayout.cpp
index 3699b3fbcf..585be0fcc9 100644
--- a/src/quicklayouts/qquicklayout.cpp
+++ b/src/quicklayouts/qquicklayout.cpp
@@ -916,7 +916,7 @@ void QQuickLayout::geometryChange(const QRectF &newGeometry, const QRectF &oldGe
{
Q_D(QQuickLayout);
QQuickItem::geometryChange(newGeometry, oldGeometry);
- if (d->m_disableRearrange || !isReady() || !newGeometry.isValid())
+ if (d->m_disableRearrange || !isReady())
return;
qCDebug(lcQuickLayouts) << "QQuickLayout::geometryChange" << newGeometry << oldGeometry;
diff --git a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
index 7f7352e25b..6961c643f0 100644
--- a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
+++ b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
@@ -926,7 +926,17 @@ Item {
},
layoutWidth: 28,
expectedWidths: [22, 6]
- }
+ },{
+ tag: "resize_to_0_width",
+ layout: {
+ type: "RowLayout",
+ items: [
+ {preferredWidth: 10, fillWidth: true},
+ ]
+ },
+ layoutWidth: 0,
+ expectedWidths: [0]
+ }
];
}