Dynamic loading data into a QML SwipeView loaded asyncronous is autmomatically increment the current index.

Loader{
    asynchronous: true
    anchors.fill: parent
    sourceComponent:  ColumnLayout{
        //Any content here that can take some time to load
        TabBar{
            Layout.fillWidth: true
            Repeater{
                model: swRepeater.model
                delegate: TabButton{
                    text: "Tab button "+index
                }
            }
        }

        SwipeView{
            //                    anchors.fill: parent
            Layout.fillWidth: true
            Layout.fillHeight: true
            currentIndex: 0
            Repeater{
                id: swRepeater
                model: 5
                delegate: Item{
                    Label{
                        anchors.centerIn: parent
                        text: qsTr("Test "+index)
                    }
                }
            }
            onCurrentIndexChanged: {
                console.debug("Index was modified to ",currentIndex)
            }
        }
    }
}

At the end of the loading data the current item and index will be 4, and not 0 as explected.

Also is displayed the last item from stack.

The same behavior can be se on the TabBar item so the problem looks to came from ListView or Container.

Any suggestion on this behavior?

0

There are 0 best solutions below