confuse stackview when push and pop (also replace) quickly. (qtquick.controls2)
-
Hi. I have a important problem with stack view. when you push and pop items quickly to stack view (for example with tabbar) the stackView confused and show empty. see video : https://youtu.be/j5qpsHcBxHk
source code: https://paste.ubuntu.com/p/bB9pnJGNCf/ -
Hi,
could it be, that you will get out of Range?
Try to add a logic at onClicked to avoid going under index == 0;Never seen that bevor
@david_001
u can use buttons instead tabbar and see this problem again. -
Can you try this:
ApplicationWindow { visible: true width: 640 height: 480 title: qsTr("Hello World") StackView { id: stackView anchors.fill: parent initialItem: page1 } TabBar { id: tabBar anchors.bottom: parent.bottom width: parent.width TabButton { text: qsTr("Page1") onClicked: stackView.pop() } TabButton { text: qsTr("Page2") onClicked: { if (stackView.depth === 1) stackView.push(page2) } } } Component { id: page1 Rectangle { color: "lightBlue" Text { anchors.centerIn: parent; text: "Page1" } } } Component { id: page2 Rectangle { color: "lightGreen" Text { anchors.centerIn: parent; text: "Page2" } } } }
Cannot reproduce when using
Component
. It seems that with your code pop transition is still incomplete and you are trying to push the same item which is currently being popped. -
Can you try this:
ApplicationWindow { visible: true width: 640 height: 480 title: qsTr("Hello World") StackView { id: stackView anchors.fill: parent initialItem: page1 } TabBar { id: tabBar anchors.bottom: parent.bottom width: parent.width TabButton { text: qsTr("Page1") onClicked: stackView.pop() } TabButton { text: qsTr("Page2") onClicked: { if (stackView.depth === 1) stackView.push(page2) } } } Component { id: page1 Rectangle { color: "lightBlue" Text { anchors.centerIn: parent; text: "Page1" } } } Component { id: page2 Rectangle { color: "lightGreen" Text { anchors.centerIn: parent; text: "Page2" } } } }
Cannot reproduce when using
Component
. It seems that with your code pop transition is still incomplete and you are trying to push the same item which is currently being popped.@intruderexcluder
Thank you man. it's work .
I will use component from now ;) -
Can you try this:
ApplicationWindow { visible: true width: 640 height: 480 title: qsTr("Hello World") StackView { id: stackView anchors.fill: parent initialItem: page1 } TabBar { id: tabBar anchors.bottom: parent.bottom width: parent.width TabButton { text: qsTr("Page1") onClicked: stackView.pop() } TabButton { text: qsTr("Page2") onClicked: { if (stackView.depth === 1) stackView.push(page2) } } } Component { id: page1 Rectangle { color: "lightBlue" Text { anchors.centerIn: parent; text: "Page1" } } } Component { id: page2 Rectangle { color: "lightGreen" Text { anchors.centerIn: parent; text: "Page2" } } } }
Cannot reproduce when using
Component
. It seems that with your code pop transition is still incomplete and you are trying to push the same item which is currently being popped. -
@mohsennz said in confuse stackview when push and pop (also replace) quickly. (qtquick.controls2):
@intruderexcluder
now how can i mark this as solved?Not sure, probably by editing original post.
-
right hand side -> topic tools -> mark as solved