How to use Loader and StackView both together, when needs some pages load once and some several times?

Viewed 48

I have a pages flow like this:

enter image description here

That i Implemented it with a "Loader" and a "StackView", "splash" and "authorize" load in "Loader", and "Dashboard" and other pages will load in "StackView", "StackView" is not nasted (load) in "Loader", Just i invisable it befor load "Dashboard" like:

Loader {
    id:loader
    anchors.fill: parent
    visible: true // till authorization
    source: "qrc:/pages/Splash.qml"
}
StackView {
    id: stack_view
    anchors.fill: parent
    visible: false // till authorization done and load dashboard
}
StateGroup {
    id: state_group
    state: "SPLASH"
    states: [
        State {
            name: "SPLASH"
            PropertyChanges {target: loader; source: "qrc:/pages/Splash.qml"}
        },
        State {
            name: "AOUTHORIZE"
            PropertyChanges {target: loader; source: "qrc:/pages/Login.qml"}
        },
        State {
            name: "STACKVIEW"
            PropertyChanges {target: loader; visible: false}
            PropertyChanges {target: stack_view; visible: true}
        }
    ]
}

As diagram shows "Splash" and "Authorize" load once, "Dashboard" and other pages may load several times, I want to know the way i used "Loader" and "StackView" is good? or how and what components is beter to use?

0 Answers
Related