I'm having issue with the icons of my Qt Windows application on Windows.
I've set the RC_FILE
with IDI_ICON1 ICON DISCARDABLE
and the icon shows correctly in Windows Explorer.
But I'm still missing the taskbar icon and the Icon that should show up in the start menu.
I already replaced the old 32x32 .ico file that worked for Windoes 7 with one having 256x256, 32x32, 48x48 and 16x16 but this didn't help either.
Any ideas what I'm missing?
Added screenshot for clarity:
Check the Taskbar Settings Click Start, then head to Settings > Personalization. From the left-hand menu, select Taskbar. Turn off the toggle below Automatically hide the taskbar in tablet mode. From the Notification section, click Select which icons appear on the taskbar.
Setting the Application Icon on Windows This can be done using Microsoft Visual Studio: Select File >> New, and choose the Icon File. Note: You need not load the application into the Visual Studio IDE as you are using the icon editor only.
When a user pins an application to the taskbar, Windows looks for a desktop shortcut that matches the application, and if it finds one, it creates a . lnk file in the directory <user dir>\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With