Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    Solved confuse stackview when push and pop (also replace) quickly. (qtquick.controls2)

    QML and Qt Quick
    4
    8
    165
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • MohsenNz
      MohsenNz last edited by MohsenNz

      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/

      1 Reply Last reply Reply Quote 0
      • David_001
        David_001 last edited by

        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

        MohsenNz 1 Reply Last reply Reply Quote 0
        • MohsenNz
          MohsenNz @David_001 last edited by MohsenNz

          @david_001
          u can use buttons instead tabbar and see this problem again.

          1 Reply Last reply Reply Quote 0
          • IntruderExcluder
            IntruderExcluder last edited by

            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 2 Replies Last reply Reply Quote 1
            • MohsenNz
              MohsenNz @IntruderExcluder last edited by

              @intruderexcluder
              Thank you man. it's work .
              I will use component from now ;)

              1 Reply Last reply Reply Quote 0
              • MohsenNz
                MohsenNz @IntruderExcluder last edited by

                This post is deleted!
                IntruderExcluder 1 Reply Last reply Reply Quote 0
                • IntruderExcluder
                  IntruderExcluder @MohsenNz last edited by

                  @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.

                  1 Reply Last reply Reply Quote 0
                  • J.Hilk
                    J.Hilk Moderators last edited by

                    right hand side -> topic tools -> mark as solved

                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct

                    Qt Needs YOUR vote: https://bugreports.qt.io/browse/QTQAINFRA-4121


                    Q: What's that?
                    A: It's blue light.
                    Q: What does it do?
                    A: It turns blue.

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post