Switch between multiple .qrc files at runtime

Viewed 2407

I have several themes folders each containing a .qrc file:

redTheme/
           - File.qml
           - qml.qrc
blueTheme/
           - File.qml
           - qml.qrc

I am currently able to switch between these themes at compile time. This means I need to change my import statement to the theme I want to use.

I would like to know if I could do this in runtime. It would give much more flexibility to the user. Example : user clicks on a Button which triggers a signal and loads another theme (from C++ or QML)

My first interrogation is : should I use .qrc files or QML Modules?

The former loads its content after being called from C++ whereas the latter compels me to use import statements.

This brings me to other questions:

  1. Can I use several .qrc files?
  2. If so, can I "unload" a .qrc file? Could be a stupid question as I'm not fully aware of the Qt Resource System mechanisms.
  3. How would I load another .qrc file? I would have my main.qrc file loading views and my themes.qrc files loading the custom QML objects.
1 Answers
Related