StackVew push is not working properly in my case.

1036
3
11-15-2020 02:50 AM
x_d
by
New Contributor III

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

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

}
next.qml
Rectangle{
    id:rect
    height: 750
    width: 300
    color: "#666666"
}
Tags (2)
0 Kudos
3 Replies
ErwinSoekianto
Esri Regular Contributor

@x_d 

 

I don't see you have StackView in the page. This is the doc on the StackView https://doc.qt.io/qt-5/qml-qtquick-controls2-stackview.html from QML, you can have Page or App in AppStudio in lieu of ApplicationWindow in that example. 

 

Thank you,

Erwin

0 Kudos
x_d
by
New Contributor III

@ErwinSoekianto  Hi, on MyApp.qml page i have used StackView, i didn't mentioned that here. Can you suggest me something

0 Kudos
ErwinSoekianto
Esri Regular Contributor

@x_d

I don't see you have StackView component on the page. See this doc on StackView from QML, https://doc.qt.io/qt-5/qml-qtquick-controls2-stackview.html You can replace ApplicationWindow with App or Page for the AppStudio app from that sample. 

 

Thank you,

Erwin

0 Kudos