Two Qt Resource Files (.qrc), switch while runtime



  • I have two Resource Files (.qrc) how can I switch between them in Qt C++ while runtime?

    Thank You.



  • I think you can't. AFAIK all resources are compiled into C++ sources by rcc. Then compiled by C++ compiler and linked to other parts of your program.


  • Moderators

    Look at "QResource":/doc/qt-4.8/qresource.html#dynamic-resource-loading under dynamic loading and unloading.



  • I already tried it with the dynamical loading link, but i can not switch to the second one.
    Is it possible with the .qrc files, too? I registered both files, setting one happens with setFileName() right?
    That does not work at my example, are there any additional terms?



  • Did you experiment with QResource::unregisterResource? I have never tried using it myself, but it seems that nothing can reference anything in the resource when you unload it. No idea if that is a problem in practice.



  • I tried it, but it does not work.

    I forgot to they, that I want to use it on Windows.

    I think it is a problem with the path. I need an absolute path, starting with /, so it seems it is Linux based.


Log in to reply
 

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