PDA

View Full Version : strange behaviour: own staticlib and images



BeS
2nd April 2009, 10:57
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!

talk2amulya
2nd April 2009, 12:19
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

BeS
2nd April 2009, 13:42
Thanks for your answer!

This is the *.pro file for the lib:



TEMPLATE = lib
CONFIG += staticlib
RESOURCES = images.qrc

...


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!

talk2amulya
2nd April 2009, 14:01
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..

BeS
3rd April 2009, 00:17
Thank you talk2amulya! Worked like described by you!