aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicklayouts
diff options
context:
space:
mode:
authorSanthosh Kumar <santhosh.kumar.selvaraj@qt.io>2024-01-09 14:05:56 +0100
committerSanthosh Kumar <santhosh.kumar.selvaraj@qt.io>2024-01-10 11:03:26 +0100
commitd85de8da6011731e3ff31ae1361e71fecaedb0be (patch)
treee5337afe76a3abcb9f22fc4bfa88dc1d38ee35fd /src/quicklayouts
parent7ab9ba60623bd3ab8992c542cab2c98053378c22 (diff)
Remove dirty flag validation during geometry change in the layout
The patch 9ad9d05f26184a79ad3fe09abdc662949088d19d adds validation to avoid rearrange in the layout as there is possibility to refer invalid QGridLayoutItem (particularly during item removal from the layout). The same can be fixed through m_disableRearrange flag which cause rearrange to happen in next polish (as with the earlier fix) instead of geometryChange(). Fixes: QTBUG-120592 Pick-to: 6.7 6.6 6.5 Change-Id: Ia17a41eeba46797631263d865de055b46e1208f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quicklayouts')
-rw-r--r--src/quicklayouts/qquicklayout.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/quicklayouts/qquicklayout.cpp b/src/quicklayouts/qquicklayout.cpp
index 28a99ced9e..df25fb7ac1 100644
--- a/src/quicklayouts/qquicklayout.cpp
+++ b/src/quicklayouts/qquicklayout.cpp
@@ -787,6 +787,7 @@ QQuickLayoutAttached *QQuickLayout::qmlAttachedProperties(QObject *object)
void QQuickLayout::updatePolish()
{
qCDebug(lcQuickLayouts) << "updatePolish() ENTERING" << this;
+ d_func()->m_disableRearrange = false;
m_inUpdatePolish = true;
// Might have become "undirty" before we reach this updatePolish()
@@ -915,8 +916,13 @@ void QQuickLayout::itemChange(ItemChange change, const ItemChangeData &value)
maybeSubscribeToBaseLineOffsetChanges(item);
QQuickItemPrivate::get(item)->removeItemChangeListener(this, changeTypes);
qCDebug(lcQuickLayouts) << "ChildRemoved" << item;
- if (isReady())
+ if (isReady()) {
invalidate();
+ // The invalidate() triggers polish and this relayout items in the
+ // layout engine. But if there is any geometry change from the same
+ // item (due to deferred deletion), its better to skip rearrange
+ d_func()->m_disableRearrange = true;
+ }
}
QQuickItem::itemChange(change, value);
}
@@ -925,7 +931,7 @@ void QQuickLayout::geometryChange(const QRectF &newGeometry, const QRectF &oldGe
{
Q_D(QQuickLayout);
QQuickItem::geometryChange(newGeometry, oldGeometry);
- if (invalidated() || d->m_disableRearrange || !isReady())
+ if (d->m_disableRearrange || !isReady())
return;
qCDebug(lcQuickLayouts) << "QQuickLayout::geometryChange" << newGeometry << oldGeometry;