Results 1 to 5 of 5

Thread: strange behaviour: own staticlib and images

  1. #1
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    20
    Thanks
    2
    Thanked 4 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default strange behaviour: own staticlib and images

    Hello!

    i have wrote a small widget which displays some images as some kind of "status-LED".

    I have compiled the widget as a static lib so that later i can link it into any program i want. The images are defined in a file called "images.qrc" and in the RESOURCE option of my qmake file.

    Now i can compile the widget and my program which links against the static lib of the widget. After i start the program everything works except that i don't see the images. I just see some coloured lines. It looks like something like a defect image-file.

    If i add the "images.qrc" also to the RESOURCE option of the application which links against the widget lib than the images will be displayed just fine.

    But i think this is somehow circular to add to every application the "images.qrc" shouldn't the image already be integrated into the static lib?

    Does someone as an idea what's wrong?

    I hope i could explain the problem... If you have any question, just ask!

    Thanks!

  2. #2
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: strange behaviour: own staticlib and images

    u'll have to compile the images using rcc and that resource should be registered with code.. Read more about it here : http://doc.trolltech.com/4.4/resources.html

    mainly about External Binary Resources and Compiled-In Resources

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    20
    Thanks
    2
    Thanked 4 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: strange behaviour: own staticlib and images

    Thanks for your answer!

    This is the *.pro file for the lib:

    Qt Code:
    1. TEMPLATE = lib
    2. CONFIG += staticlib
    3. RESOURCES = images.qrc
    4.  
    5. ...
    To copy to clipboard, switch view to plain text mode 

    so the images should be compiled into the libs, shouldn't they?

    That's why i'm confused that i have to comilie the resources also into the main application which uses the lib. As i understand it, the images should be already in the lib...

    Or do i have an error in reasoning?

    Thanks!

  4. #4
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: strange behaviour: own staticlib and images

    images arent already compiled into the lib i believe..u'll have to use rcc to create a binary and add a reference to that resource into the code..when u build that, then you should have a lib with compiled resources..

  5. The following user says thank you to talk2amulya for this useful post:

    BeS (2nd April 2009)

  6. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    20
    Thanks
    2
    Thanked 4 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: strange behaviour: own staticlib and images

    Thank you talk2amulya! Worked like described by you!

Similar Threads

  1. Strange xml behaviour when opening the file.
    By cbarmpar in forum Qt Programming
    Replies: 5
    Last Post: 28th September 2008, 20:44
  2. qinputdialog strange behaviour
    By dreamer in forum Qt Programming
    Replies: 1
    Last Post: 11th May 2008, 19:29
  3. very strange behaviour
    By regix in forum Qt Programming
    Replies: 23
    Last Post: 20th July 2006, 17:38
  4. Replies: 1
    Last Post: 26th February 2006, 05:52
  5. [Qt 4.1] Strange behaviour with QTableView
    By fane in forum Qt Programming
    Replies: 1
    Last Post: 23rd January 2006, 06:17

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.