PDA

View Full Version : icon



Maluko_Da_Tola
26th August 2010, 11:45
Hi,

I want to display an icon on a button. I added a prefix and the correspondent .png file to the project. Then I used the following syntax:

OKbutton->setIcon(QIcon(":/GraphicBarrier/Headphones-32.png"));

The code compiles but NO icon is displayed. Why is this happening?

Thank you

Tomasz
26th August 2010, 12:58
I had the same problem. If You are using QT Creator try to create resource file, and then use it like that:


myButton->setIcon(QIcon(":/_YOUR_PREFIX_/icon.png"));


best regards
Tomasz

Maluko_Da_Tola
26th August 2010, 13:15
Thanks very much ;)