How doing page navigation in QT Quick



  • I want to write an app for my Raspberry Pi 2,8 " TFT TouchScreen Panel.

    I designed two qml files (both as type Rectangle).

    Now I don't know how to change from screen1 to scree2 - with a Transition would be very nice...

    Can anybody help me with this problem?

    thx!



  • Hello,

    i think aou should have a look at "this...":http://qt-project.org/doc/qt-5/qml-qtquick-controls-stackview.html



  • Is there some sample code available of how to use this?

    My problem is I have three QML files, in which should I insert the StackView and how exactly?

    thx !



  • Normally you have a main file, your app window who you can add the stack item and now you can add other components/files as a page to the stack item with pop and push. Everything is explained in the documentation! Here a very simple and maybe not fully working example, i'm not at home so no guaranty.
    @
    Rectangle {
    Button {
    onClick: {
    stack.push(
    {
    item: Qt.resolvedUrl("MySecondItem.qml"),
    immediate: true,
    replace: true
    }
    );
    }
    }
    StackView
    {
    id: stack
    initialItem: Qt.resolvedUrl("MyFirstItem.qml")
    }
    }
    @



  • Please mark threads as solved if it's done thx


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.