diff options
| author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2025-07-08 14:59:56 +0200 |
|---|---|---|
| committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2025-07-08 19:40:03 +0200 |
| commit | 9352ef3c167bf1edfc033f14027fe38df1b9bf17 (patch) | |
| tree | 34159df8321f953f8b44839b561bbfbb6a8de970 /src/quicklayouts/qquicklayout.cpp | |
| parent | ef75f234d2fc7125eddf8ab8c49d7a2f8ca4049f (diff) | |
Allow recursive layout of ApplicationWindow
The safe areas require recursive layouting of the ApplicationWindow
menu bar, header, and footer (in particular). We added guards preventing
that in 6dc95399797de4ec27984956df1fa587f4eb18ba, to fix QTBUG-87708,
but the fix for that can be in QQuickLayout itself.
Pick-to: 6.10
Task-number: QTBUG-87708
Change-Id: I0dc25d779fe76619591f35063826d50dff2e3d28
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Diffstat (limited to 'src/quicklayouts/qquicklayout.cpp')
| -rw-r--r-- | src/quicklayouts/qquicklayout.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/quicklayouts/qquicklayout.cpp b/src/quicklayouts/qquicklayout.cpp index 3da13ba10a..0dd0d27eed 100644 --- a/src/quicklayouts/qquicklayout.cpp +++ b/src/quicklayouts/qquicklayout.cpp @@ -948,12 +948,30 @@ void QQuickLayout::itemChange(ItemChange change, const ItemChangeData &value) void QQuickLayout::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) { Q_D(QQuickLayout); + qCDebug(lcQuickLayouts) << "QQuickLayout::geometryChange" + << oldGeometry << "-->" << newGeometry; + QQuickItem::geometryChange(newGeometry, oldGeometry); + if ((invalidated() && !qobject_cast<QQuickLayout *>(parentItem())) || d->m_disableRearrange || !isReady()) return; - qCDebug(lcQuickLayouts) << "QQuickLayout::geometryChange" << newGeometry << oldGeometry; + // The geometryChange call above might recursively update the + // geometry of this layout, via item change listeners, in which + // case the recursive call has already rearranged the layout for + // the new size. We don't want to rearrange here based on the old + // 'new geometry', as that would revert the most up to date layout. + const qreal w = d->width.valueBypassingBindings(); + const qreal h = d->height.valueBypassingBindings(); + const QSizeF currentSize(w, h); + if (currentSize != newGeometry.size()) { + qCDebug(lcQuickLayouts) << "QQuickItem::geometryChange resulted" + << "in size change from" << newGeometry.size() << "to" + << currentSize << "; layout should already be up to date."; + return; + } + rearrange(newGeometry.size()); } |
