You didn't mark which Qt version you're using, so I'll comment on both qt4 and qt5.
Taskbar Icon
In both versions the Windows taskbar icon is derived from your Dialog/MainWindow/Widget's icon (see https://stackoverflow.com/a/29285256). You can set this for the specific window and its children with QWidget::setWindowIcon().
This should solve your problem, but I'll talk about the Explorer icon, too, for the sake of completeness.
Explorer/Start Menu Icon
Explorer.exe and the Start Menu icons are derived from a *.rc file generated either by you or by qmake. You can set this using your own *.rc file with RC_FILE in Qt4 or Qt5 as described in the comments to your question and I believe you've attempted, but sometimes this will create a conflict with other qmake calls like VERSION
that create a second *.rc file that overrides the first.
Unfortunately, in Qt4 you're out of luck. You must either do all of that work yourself in the *.rc file or give up some features like VERSION.
However, Qt5 added a new option RC_ICON that plays nicely with the other RC-related qmake variables. As long as you're okay with qmake generating the *.rc file, that should do the trick.
The application icon set here should cascade to the window icon in the taskbar and title bar, but in my experience it doesn't seem to happen and it makes more sense to set them separately. The resolutions are different anyway so it's nice to have finer control.
See this link for official Qt5 documentation: http://doc.qt.io/qt-5/appicon.html
.rc
files contain two icon entries:IDI_ICON1 ICON DISCARDABLE "myApp.ico"
andIDI_APPICON ICON "myApp.ico"
. I just googledIDI_APPICON
but all I could find were a#define IDI_APPICON 101
in some hits. I even don't know where theIDI
s come from on my side. WinAPI? There is no such definition in our sources. – Scheff's Cat.rc
file that the order of icon definitions is important:// Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems.
– Scheff's Cat