Results 1 to 4 of 4

Thread: Qt Resources

  1. #1
    Join Date
    Jun 2008
    Posts
    89
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Qt Resources

    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

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Qt Resources

    Add the resources file (.qrc) to your project file (.pro).
    Run (qmake if you change the .pro file, then) make.

  3. #3
    Join Date
    Jun 2008
    Posts
    89
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Qt Resources

    The file is already included in VC project....
    Contents of qrc file are below.

    Qt Code:
    1. <!DOCTYPE RCC>
    2. <RCC version="1.0">
    3. <qresource prefix="/" >
    4. <file>res/test.xml</file>
    5. <file>images/MyImage.png</file>
    6. </qresource>
    7. </RCC>
    To copy to clipboard, switch view to plain text mode 

    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

  4. #4
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt Resources

    Did You have commercial licence for Qt ?
    If not You must in properties of qrc file create a rule (something like this) :
    Qt Code:
    1. $(QtDir)\bin\rcc.exe -name $(InputName) "$(InputPath)" -o "GeneratedFiles\qrc_$(InputName).cpp"
    To copy to clipboard, switch view to plain text mode 

    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

Similar Threads

  1. Is it possible to add QT resources to a DLL?
    By cboles in forum Qt Programming
    Replies: 4
    Last Post: 17th January 2017, 00:12
  2. Resources cannot be read under Designer
    By Flakes in forum Qt Tools
    Replies: 1
    Last Post: 24th January 2008, 08:28
  3. Distributing an application with resources
    By ntp in forum Qt Programming
    Replies: 3
    Last Post: 6th October 2007, 01:46
  4. Compiled resources in shared library
    By magland in forum Qt Programming
    Replies: 1
    Last Post: 21st June 2007, 04:57
  5. problem with resources
    By SuperSonik in forum Installation and Deployment
    Replies: 2
    Last Post: 15th February 2007, 10:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.