How to close a QML application from another QML Application?



  • Hello All,
    I have written a qml application (a base screen with a list view) and am calling another qml application (another .qml file) from the base screen. But I could not find out how to close the called application only. When I use the Qt.quit(), it quits the whole application. Is there a way to close only the called application?



  • Hi,

    What do you mean by "am calling another qml application"? Are you using a Loader element?
    Anyway, when you want to close it, you can try to hide it (set visible to false).

    Regards,
    wladek



  • Yep, .qml file is not an application. Application is your binary file, which runs these qmls (or QmlViewer if you run them from it). And Qt.quit() closes apllication itself (with all qmls loaded).



  • [quote author="wladek" date="1303799170"]Hi, What do you mean by "am calling another qml application"? Are you using a Loader element? Anyway, when you want to close it, you can try to hide it (set visible to false). Regards, wladek[/quote]
    Hello, thanks for the reply. Yes, I'm using the Loader element. Hiding is an option, but what I would like to do is close the loaded qml.



  • What do you mean by closing qml? Unloading it, hiding it, whatever else?



  • [quote author="Denis Kormalev" date="1303802222"]What do you mean by closing qml? Unloading it, hiding it, whatever else?[/quote]
    I mean, how can I unload it?



  • For what do you need it? When you end using object it will be disposed at some time with gc.


  • Moderators

    From the "Loader docs":http://doc.trolltech.com/4.7-snapshot/qml-loader.html#source-prop ...

    bq. To unload the currently loaded item, set [source] to an empty string, or set sourceComponent to undefined.



  • Thanks for all the replies. The set[source] to empty string works for me. I missed it in the documentation.



  • [quote author="A350XWB" date="1307597557"]Thanks for all the replies. The set[source] to empty string works for me. I missed it in the documentation.[/quote]

    i cant understand what this is.
    but i do have the same problem.. help please. :)



  • You should have clicked the link posted by @mlong in which is says:
    [quote]
    To unload the currently loaded item, set this property to an empty string, or set sourceComponent to undefined. Setting source to a new URL will also cause the item created by the previous URL to be unloaded.
    [/quote]



  • THANKS! :)
    i made it..


Log in to reply
 

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