aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicklayouts
diff options
context:
space:
mode:
authorSanthosh Kumar <santhosh.kumar.selvaraj@qt.io>2023-03-31 17:44:10 +0200
committerSanthosh Kumar <santhosh.kumar.selvaraj@qt.io>2023-04-14 13:20:42 +0200
commite397e5b43c9a9844e652adf5ef55365e0a40f57b (patch)
tree6bf031fe4cedce4ec2c3b6b23e048e205138e03a /src/quicklayouts
parent8fc8a2df6ed404ff19fb59a655e669c78318bcfe (diff)
Fix stack layout index when loaded asynchronously
Lazy loading of stack layout causes incorrect index value in the attached property for the child items. This is because, attachedProperties are created and updated for the child object, after being added to the stack layout. This patchset triggers childItemsChanged() to reset child objects of stack layout with right index value. Fixes: QTBUG-111902 Pick-to: 6.4 6.5 Change-Id: Iad06d028d0f977189b5da1122904dc754060a609 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quicklayouts')
-rw-r--r--src/quicklayouts/qquickstacklayout.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/quicklayouts/qquickstacklayout.cpp b/src/quicklayouts/qquickstacklayout.cpp
index e07a44053b..5959cc571c 100644
--- a/src/quicklayouts/qquickstacklayout.cpp
+++ b/src/quicklayouts/qquickstacklayout.cpp
@@ -387,6 +387,11 @@ QQuickStackLayoutAttached::QQuickStackLayoutAttached(QObject *object)
setLayout(stackLayout);
setIndex(index);
setIsCurrentItem(stackLayout->currentIndex() == index);
+
+ // In case of lazy loading in loader, attachedProperties are created and updated for the
+ // object after adding the child object to the stack layout, which leads to entries with
+ // same index. Triggering childItemsChanged() resets to right index in the stack layout.
+ stackLayout->childItemsChanged();
}
/*!