Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.5.5
-
None
Description
Asyncronous loading can cause QML components to complete in different orders, by design. The StackLayout seems to be dependent on this initialization order which can cause the wrong item to be shown.
Reproducible example:
import QtQuick import QtQuick.Window import QtQuick.Layouts Window { width: 640 height: 480 visible: true title: qsTr("Hello World") Loader { asynchronous: true sourceComponent: StackLayout { id: sl currentIndex: 0 anchors.fill: parent Repeater { model: 10 Text { text: `${index}: ${StackLayout.index} - ${sl.currentIndex}` color: "black" Component.onCompleted: console.log("created", index) } } } } }
When setting asynchronous: false you get the expected behavior: