Constructing tray icon with QIcon
Hello,
I have made tray icon with QSystemTrayIcon.
I use following to set icon of trayicon (I use qrc resources):
trayicon->setIcon(QIcon(":/ikona/sending.gif"));
On my computer icon is constructed ok, but when deployed on another computer, I get empty icon - tray icon with no picture in it. How is this possible - I thought that Qt resources are compiled into binary and because of that always available when deployed to another computer? Any idea, what is wrong here?
Re: Constructing tray icon with QIcon
try this:
trayIcon = new QSystemTrayIcon(this);
icon.addPixmap(QPixmap(QString::fromUtf8(":/mailbox.png")), QIcon::Normal, QIcon::Off);
trayIcon->setIcon(icon);
for this you need to add the image file name into your qrc file also don't forget to copy the image file while moving to other system.
:)
Re: Constructing tray icon with QIcon
It could also be a problem of image plugin.
copy the proper dll from QTDIR\plugins\imageformats to your destination and see if it works
Re: Constructing tray icon with QIcon
Thanks for suggestions, I converted gif to png, and now it works! Excellent!
Re: Constructing tray icon with QIcon
Quote:
I converted gif to png, and now it works!
Then surely it must be a case of missing image plugin dll. Try my last post and see if it works for gif ?
Also is ur qt built with gif support ?
Re: Constructing tray icon with QIcon
I am not sure if I've done it right. I copied qgif4.dll into plugins\imageformats subfolder of where my exe is deployed.
It still does not work with gif.
I am using prebuilt Qt binaries that came with 2009.03.
Re: Constructing tray icon with QIcon
Hi
Quote:
Originally Posted by
Tiansen
I am not sure if I've done it right. I copied qgif4.dll into plugins\imageformats subfolder of where my exe is deployed.
you must copy this dll into imageformats subfolder of where your exe is deployed and not plugins\imageformats ;)
Re: Constructing tray icon with QIcon
Yes and now it works with gif too!!! Thanks!