July 27, 2012

Thanatos.jsse Thanatos.jsse
Ant Farmer
72 posts

QMake and resources

 

Hi,

I’m using on my application a binary resource, this is compiled using:

  1. $ rcc -binary -no-compress myResource.qrc -o myResource.rcc

Then I copy the *.rcc to ${BUILD_PATH}/share folder. (¬¬ using cp $path_to_myResource path_to_mySharedFolder).

The question is:

How can I configure my *.pro file for let do this work (compile the resource file) to qmake tool?

  1. # I've tried to use
  2. CONFIG += resources
  3. # ...
  4. QMAKE_RESOURCE_FLAGS += -no-compress -binary

Thank your for your help.

5 replies

July 27, 2012

Tomma Tomma
Ant Farmer
58 posts

Just adding

  1. RESOURCES += <resource>.qrc

should do.

July 27, 2012

Thanatos.jsse Thanatos.jsse
Ant Farmer
72 posts

Tomma wrote:
Just adding
  1. RESOURCES += <resource>.qrc

should do.

Yes Tomma, that’s correct. All resource file must be added to RESOURCES variable.

But how can I tell to qmake: Over this resource use rcc -binary -no-compress resource.qrc -o resourceOutput.rcc

July 27, 2012

Hostel Hostel
Hobby Entomologist
187 posts

QMake variable:

  1. QMAKE_POST_LINK

You can create script which will make rcc file and copy to destination folder. Next you should add this script in QMAKE_POST_LINK. Don’t forget to no add your qrc file to RESOURCES if you want load rcc dynamicly. Sorry for my flawed English.

July 27, 2012

Thanatos.jsse Thanatos.jsse
Ant Farmer
72 posts
Hostel wrote:
QMake variable:
  1. QMAKE_POST_LINK

Thank you Hoste, that is a good solution, I have only one problem, create each script to be used on each platform.

PD: You make me look in google translate for word flawed :P

Best regards,

July 27, 2012

Hostel Hostel
Hobby Entomologist
187 posts

In near future I will use QMAKE_POST_LINK in my .pro file for creating rcc by script and I think that I will use Python – it’s cross platform.

 
  ‹‹ How can I turn on compiler warnings on Qt Creator?      [SOLVED] QSqlDatabase: QMYSQL driver not loaded ››

You must log in to post a reply. Not a member yet? Register here!