PDA

View Full Version : Qt Resources



kaushal_gaurav
1st October 2008, 20:40
Hi,

How do i make sure that when i compile the project the Qt resources get embed in the application.
I mean i have a .qrc file and when i change some thing in the resources referred in that qrc file. how do i make it sure that it goes into the application.
do i need to rebuild the whole application for this...
or is there some other way?

Please help...

Regards,
GK

caduel
2nd October 2008, 07:28
Add the resources file (.qrc) to your project file (.pro).
Run (qmake if you change the .pro file, then) make.

kaushal_gaurav
3rd October 2008, 08:21
The file is already included in VC project....
Contents of qrc file are below.



<!DOCTYPE RCC>
<RCC version="1.0">
<qresource prefix="/" >
<file>res/test.xml</file>
<file>images/MyImage.png</file>
</qresource>
</RCC>


The problem here is that.. the qrc file contains references to two resources..
but when i change some thing in XML file the project is not recomiple to take effect of those changes (but rebuild does).
The other resource is used as title bar image and any change made to it makes the projec to compile and take the effect.

I guess the problem is that test.xml file is not attached to any item on the dialog... but i tried to place this test.xml as the test label image.. but no Luck....
Help....
GK

Lesiok
3rd October 2008, 16:30
Did You have commercial licence for Qt ?
If not You must in properties of qrc file create a rule (something like this) :

$(QtDir)\bin\rcc.exe -name $(InputName) "$(InputPath)" -o "GeneratedFiles\qrc_$(InputName).cpp"

Then You must add to project file GeneratedFiles\qrc_$(InputName).cpp where $(InputName) is a name of Yours qrc file.

With commercial licence and VS Integration package this is done automagicaly :cool: