QSystemTrayIcon and relative path
-
Hi,
How do you use an relative path on the systemtray icon image file? Right now I am using:
trayIcon->setIcon(QIcon("absolute path""))
-
Use it as with every other relative path. The starting point is the current working directory, that's often the directory containing your exe.
-
Thanks for the reply.
Okay, but do you know how I can include these image files into the same directory as the exe when I press run in QT Creator?
-
A good approach for that small icons is to put them into a "Qt resource file":/doc/qt-4.7/resources.html. This way the icon is compiled into your application exe and you do not need to distribute it separately. Qt Creator has support for creating the resource file, but hand crafting is not difficult either.
-
That was the exact answer I was looking for! Thanks:)
-
The easiest way must be using the [[doc:resources]]