How to change taskbar icon during runtime on windows
-
Hi all,
I've created a Qt application to talk with a remote device and I want to change the taskbar icon to show if the device is connected or not.
I've tried it thanks to QWidget::setWindowIcon() on my mainwindow and later with QApplication::setWindowIcon().
Both works fine when I run my app from Qtcreator.
But, after deploying it, when I run my application "normally" (say windows start menu), the icon shown in the taskbar is the .exe file's icon (set thanks to "Setting the Application Icon":http://doc.qt.nokia.com/4.7-snapshot/appicon.html) and not the mainwindow icon...
This result is the same on XP, Vista and Seven ...
What am i missing ?
Thanks in advance,
tom. -
This could help to set the exe icon:http://doc.qt.nokia.com/4.7-snapshot/appicon.html
-
thank you for your prompt answers !
@fluca1978 :
I don't have any problem with the exe icon. It's correctly set thanks to the way explained in your link. My problem is that it's this icon which is shown in the task bar instead of those I wan't to set during runtime.@broadpeak :
I'm affraid I don't understand what you mean (I'm a newbie ...) :
I can set all widget icons I want inside my application but not the taskbar one because it is inevitably managed by the OS ?
I won't be able to change it programmatically ? -
As I know, there are two kind of icons:
Windows Resource Icon for applications (all other, yet Visual C++ uses too)
and
Qt Resource Icon for inside(!) in a Qt applications,
for example widgets, dialogs and so one.
The two are different!
For example:
the application icon is platform dependent!
The other is platform INdependent. -
If I get it right the taskbar is showing the exe icon while you want another icon. As Broadpeak explained, the icon in the taskbar is platform dependent and depends on how the application "taskbar" on windows manages icons. I don't think there is a common and simple solution for this.