How to change source



  • Hi.
    I'm using this row
    @this->setSource(QUrl("qrc:qml/qml/MyMobilePetTouch/QMMainForm.qml"));@
    to set the main qml screen. But How can I chage to another file?
    If I run
    @QtQuick2ApplicationViewer *Quick2ApplicationViewer= new QtQuick2ApplicationViewer(this);
    Quick2ApplicationViewer->setSource(QUrl("qrc:qml/qml/MyMobilePetTouch/QMTools.qml"));
    Quick2ApplicationViewer->showExpanded();@
    the main screen is under and I want to replace with another new one...
    How can I do to load a new qml file?



  • Hi,
    One way to do this is to use the visible property to hide or show an Item. Do several components ( one for each page ) and use visible to go from one screen to another. If there are too many pages, you can also load them dynamicaly.
    Sincerely



  • I have used Loader to embed in the main qml file the new files, as pages but I don't like so mutch this approach. With Declarative I can change the screen as I want.


Log in to reply
 

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