Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. confuse stackview when push and pop (also replace) quickly. (qtquick.controls2)
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Solved QML and Qt Quick
8 Posts 4 Posters 451 Views 1 Watching
  • 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.
  • M Offline
    M Offline
    MohsenNz
    wrote on 4 Sept 2019, 07:39 last edited by MohsenNz 9 Apr 2019, 07:59
    #1

    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
    0
    • D Offline
      D Offline
      David_001
      wrote on 4 Sept 2019, 07:46 last edited by
      #2

      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

      M 1 Reply Last reply 4 Sept 2019, 08:00
      0
      • D David_001
        4 Sept 2019, 07:46

        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

        M Offline
        M Offline
        MohsenNz
        wrote on 4 Sept 2019, 08:00 last edited by MohsenNz 9 Apr 2019, 08:01
        #3

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

        1 Reply Last reply
        0
        • I Offline
          I Offline
          IntruderExcluder
          wrote on 4 Sept 2019, 10:01 last edited by
          #4

          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.

          M 2 Replies Last reply 4 Sept 2019, 10:42
          1
          • I IntruderExcluder
            4 Sept 2019, 10:01

            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.

            M Offline
            M Offline
            MohsenNz
            wrote on 4 Sept 2019, 10:42 last edited by
            #5

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

            1 Reply Last reply
            0
            • I IntruderExcluder
              4 Sept 2019, 10:01

              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.

              M Offline
              M Offline
              MohsenNz
              wrote on 4 Sept 2019, 11:26 last edited by
              #6
              This post is deleted!
              I 1 Reply Last reply 4 Sept 2019, 11:31
              0
              • M MohsenNz
                4 Sept 2019, 11:26

                This post is deleted!

                I Offline
                I Offline
                IntruderExcluder
                wrote on 4 Sept 2019, 11:31 last edited by
                #7

                @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
                0
                • J.HilkJ Offline
                  J.HilkJ Offline
                  J.Hilk
                  Moderators
                  wrote on 4 Sept 2019, 11:35 last edited by
                  #8

                  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


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

                  1 Reply Last reply
                  0

                  1/8

                  4 Sept 2019, 07:39

                  • Login

                  • Login or register to search.
                  1 out of 8
                  • First post
                    1/8
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved