How to change taskbar icon during runtime on windows
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 [doc.qt.nokia.com]) and not the mainwindow icon…
This result is the same on XP, Vista and Seven …
What am i missing ?
Thanks in advance,
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.
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)
Qt Resource Icon for inside(!) in a Qt applications,
for example widgets, dialogs and so one.
The two are different!
the application icon is platform dependent!
The other is platform INdependent.