Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Using .rcc File Generated By rcc tool in qmake project



  • Hi,

    My goal is to add a zip file in my application and use it (by extracting somewhere else in user's computer) as qt resource system. However, in .pro file, using RESOURCES variable to add a zip file in a qrc file, ends with a CPP file that compiles and eventually embeds into exe. My zip file is relatively bigger and compilation takes time. So I want to add it as binary file in my pro file. I can generate a .rcc file using the rcc tool (rcc -no-compress -binary zipfile.qrc -o zipfile.rcc). Now the question is how can I embed the zipfile.rcc into my application exe so that I can use it as qt normal resource system way.

    Note that, I can easily do that with qt5_add_binary_resources function in make, that actually embeds a binary resources into app and does not generate cop file for it. Wondering what is the make equivalent of it.

    Thanks a lot in advance!


  • Moderators

    You can load external resources using Q_INIT_RESOURCE in c++ code.

    If you mean to ask how to generate rcc file using qmake (without using RESOURCES), then it's pretty easy. For example:

    QMAKE_POST_LINK += $$[QT_INSTALL_BINS]/rcc -no-compress -binary zipfile.qrc -o zipfile.rcc
    

    This will generate a standalone RCC file. You can also use a custom compiler for this if you want to.


Log in to reply