I have a little application that loads a QML file from a server and displays some kind of "book shelf" to the user.
The user can pick one of the displayed books and C++ will download a ZIP file in the background, unpacks it. The result is a folder for each book on the file system with a "main.qml" file which is basically a self-contained version of the book, allowing the user to browse/zoom/etc.
I'm using ApplicationWindow
to display the book shelf in its QML file, and now I'm wondering what would be the best approach to "switch" to the book and display it in the ApplicationWindow. By best I mean, it would be nice if the book shelf is pretty much "unloaded" from memory to free resources for the book display.
How would I do this?
My rough ideas, which don't feel quite "right" were:
QQmlApplicationEngine::load()
to load another URL? Any suggestions are appreciated!
The most basic solution would be to just use a Loader
in your application window. Set it use your main.qml
on instantiation, and then when the user selects a book, set the Loader
's source to the book's QML file.
However it would better to load the 'screens' dynamically, then you could use transitioning effects before destroying the previous screen.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.