Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt application misses start menu and taskbar icon on Windows 10

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:

enter image description here

like image 893
Hurzelchen Avatar asked Mar 20 '18 15:03

Hurzelchen


People also ask

Why are my applications not showing on my taskbar?

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.

How set Qt application icon?

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.

Where are quick launch shortcuts stored Windows 10?

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.


1 Answers

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

like image 176
Phlucious Avatar answered Oct 31 '22 03:10

Phlucious