qml picture page migration

The effect you want to achieve pictorial for migration, there are many ways: for example, by qml loader will load, then, or the visible set to false or souce become an empty string. Or by dynamically created objects can, however, put our hands-not so that it all up, this is why? When an error is to be migrated to the sprite page, that it could not find the sprite id page, I clearly defined in main.qml in all, this really is not clear. qt creater have no problem. Later qml have a control called StackView , enough to make this control.

        StackView {
            id: stack
            anchors.centerIn: parent
            width: parent.width
            height: parent.height

            Loader{
                id:page_loader_main_menu
                width: parent.width
                height: 600
                anchors.right: parent.right
                anchors.top: parent.top
                source: "Main_menu.qml"
            }
        }
        Component{
            id:main_menu_search_page
                Loader{
                    id:page_loader_main_menu_search
                    width: main_menu_rec.width
                    height: 600
                    source :"Search_Hot.qml"
                }
        }

        Mini_Player{}
        Connections{
            target: main_menu_control_observer
            onMain_menu_lift_search_hot:{
                stack.push(main_menu_search_page)
                console.log("depth:",stack.depth)
            }
            onSearch_hot_lift_main_menu:{
                console.log("return_depth:",stack.depth)
                if(stack.depth === 1) {stack.clear()}
            }
        }
    }

Here not much of a problem, repeatedly using C ++ and qml interaction. Because the sprite page does not recognize the id, the people are silent. Now out of too much trouble. When drawing page migration to Search_Hot.qml , the painting had been able to click on the button root page, leading to keep the stack migration painting page.

In Search_Hot.qml , the uppermost position of the following code is added to prevent the penetration of the mouse

    MouseArea{
        anchors.fill:parent
        enabled:true
        onClicked: {}
        onPressed: {}
        onReleased: {}
    }

But why, when the real machine, dynamically created objects are not easy to use it? Who can give me this answer next?

Guess you like

Origin www.cnblogs.com/wxmwanggood/p/11003591.html