aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Arve Sæther <jan-arve.saether@qt.io>2023-04-21 16:27:50 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-04-25 17:39:12 +0000
commitef8b5344e754f1c0f13d17f4f274e9a2a8c01bb3 (patch)
tree9deeebc2a61e694ba6fc0926dc0f8b04ecc88649
parent79874d568cc708a850d104dae0c899ba3277282b (diff)
Avoid rebuilding the layout before the component is complete
isReady() will only return true *after* componentComplete() and *before* destruction is about to happen There is no point in rebuilding the layout when an item is added or removed before the component is ready, because there will be a full layout rebuild as soon as the component is completed. This is a preparation for fixing QTBUG-112691 Change-Id: I6e19578d847c6d4518479bc00f21442333e0fb07 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit b9524e4e8d30781413cf200f440c182b9ade52e5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/quicklayouts/qquickstacklayout.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/quicklayouts/qquickstacklayout.cpp b/src/quicklayouts/qquickstacklayout.cpp
index 5959cc571c..14ebcb434d 100644
--- a/src/quicklayouts/qquickstacklayout.cpp
+++ b/src/quicklayouts/qquickstacklayout.cpp
@@ -159,6 +159,8 @@ void QQuickStackLayout::componentComplete()
void QQuickStackLayout::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value)
{
QQuickLayout::itemChange(change, value);
+ if (!isReady())
+ return;
if (change == ItemChildRemovedChange) {
QQuickItem *item = value.item;