PDA

View Full Version : compile icon into application



BlackFoXX
1st May 2009, 18:32
Hi,
is it possible to compile an icon directly into my application?
I've build a button an set a QIcon:


QPushButton button1 = new PushButton("button with icon", this);
button1->setIcon(QIcon("path/to/icon");
But then the icon has to be in the directory of my application.
Background is the licence of the icon-set. It is not allowed to distribute the icons, but to compile it into the application.

I hope you can help me.
Thanks in advance.
Greetz,

Jones

fullmetalcoder
1st May 2009, 18:41
Would you be looking for the Resource System (http://doc.trolltech.com/4.5/resources.html) by any chance?

It puzzled me to see how complicated it could be to reach this page, even knowing it existed so, for once, the blame is on the docs.

BlackFoXX
1st May 2009, 18:50
Wow. Thanks for the fast answer.
Looks good. It should help.
Since i'm compiling my application with scons I hope it provides a tool for that.

fullmetalcoder
1st May 2009, 19:05
Since i'm compiling my application with scons I hope it provides a tool for that.
If scons supports Qt well enough to handle moc it should offer an easy way to manage qrc files. If it does not you can still generate the .cpp files by hand using rcc and add them to your project.

BlackFoXX
1st May 2009, 21:41
It works without any problems.
Problem solved! Thread closed! :cool: