Important: Please read the Qt Code of Conduct -

StackView pop

  • Hi,
    I develop a android app using Qt. I have a StackView in main.qml. I use this StackView push other page. I have page A, B, C, D...
    Now, in main StackView push A page, in A push to B, in B push to C... ( A->B->C ) When in page C, I want to pop page A not B.
    How to I do this?


        StackView {
            id: stackView
            anchors.fill: parent
       Button { onClicked:  stackView.push("qrc:/A.qml") }
       Button { onClicked:  stackView.push("qrc:/B.qml") }
       Button { onClicked:  stackView.push("qrc:/C.qml") }
       Button { onClicked:    // I want to pop to page A not B }


  • Moderators

    See the docs:

    If the item argument is specified, all items down to (but not including) item will be popped. If item is null, all items down to (but not including) the first item is popped. If not specified, only the current item is popped.

    To get back to A, you can call:

    // or

Log in to reply