Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to link to another qml page via onClicked?



  • MouseArea {
    anchors.fill: parent
    onClicked: {
    // Only change state when two other rectangle color is red
    if ((Qt.colorEqual(rect3.color, "blue") && Qt.colorEqual(rect4.color, "red"))
    {

                       pageLoader.source="common/WinScene.qml"
                   }
    
                   else
                   {
                     stillItchy.visible = true
    
    
    
                       }
    

    As shown above, is it right to state " pageLoader.source="common/WinScene.qml"?? Just to link to another page? My code kinda screwd up..


  • Moderators

    Yes it is OK to load pages via Loader element. Is that what you are asking?

    If you have a set of pages you want to switch between, you can use StackView, SwipeView etc. instead.


Log in to reply