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:
- Use
QQmlApplicationEngine::load()
to load another URL? - Add the book's QML component as a topmost child object to the shelf; but this would result in lots of wasted resources.
- ...?
Any suggestions are appreciated!