Important: Please read the Qt Code of Conduct -

Stack view is not working at some places

  • So on a button click, one popup shows and that popup has one button , on button click i have to redirect to another page. But when I click on that button the next page is not showing properly(its like half of current page and half of next page) and then app stops responding.
    here is the code sample

        background: Rectangle {
            id: page1
            width: parent.width
            height: 750
            color: "#333333"
                                text: qsTr("NEXT PAGE")
                                height: 48
                                Layout.preferredWidth: 290
                                anchors.centerIn: parent
                                onClicked: {
        Popup {
            visible: false
            id: popup
            background: Rectangle {
                implicitWidth: 300
                implicitHeight: 200
                color: "#ffffff"
               Button {
                id: signin_btn
                text: qsTr("SIGN IN")


    import QtQuick.Controls 2.2
    import QtQuick.Layouts 1.1
    import QtQuick 2.7
        height: 750
        width: 300
        color: "#666666"

  • Moderators

    That top-level page lives inside the stackView?

    I don't know what's wrong here (and as seen on your other posts, there is generally something wrong with your stack view). I'll share some ideas to try out, but I have no idea if they will help:

    • move popup outside of Page component (and even outside of stackView)
    • in popup button handler, call stackView.push() before you close the popup
    • do not specify width/height in next.qml, let the stack view handle it. It should do it even now, but maybe there is some bug here? Who knows

    I suspect what's happening is that when you push to stack view, the old page (and popup which is defined inside of it!) gets deleted and so it crashes. But I am not sure.

  • @sierdzio popup doesn't supports outside of the Page component.

  • Moderators

    @trupti007 said in Stack view is not working at some places:

    @sierdzio popup doesn't supports outside of the Page component.

    It most definitely does support that case. If your Page is top-level in a file, then you can emit a singnal to it's parent to ask it to show the popup.

Log in to reply