I see the below question.
QML Swipeview dynamically add pages
But, when i did removeItem(B) and addItem(B).
"item B" was not added.
SwipeView {
id: swipeView
anchors.fill: parent
currentIndex: 0
Component.onCompleted: {
addItem(A)
addItem(B)
removeItem(B)
addItem(B)
}
}
PageIndicator {
id: indicator
count: {
console.log("swipeView.count : ", swipeView.count)
return swipeView.count
}
currentIndex: swipeView.currentIndex
anchors.bottom: swipeView.bottom
anchors.horizontalCenter: parent.horizontalCenter
}
Result of console.log("swipeView.count : ", swipeView.count)
qml: swipeView.count : 0
qml: swipeView.count : 1
qml: swipeView.count : 2
qml: swipeView.count : 1
qml: swipeView.count : 2
qml: swipeView.count : 1
That is, if an item that has been erased is added again, the item is not added.
How can I fix this?