Icon sizes incorrect
I have an icon which contains the sizes: 16x16, 32x32, 48x48 and 256x256. In my application, I would like to use the 32x32 size in the Windows taskbar, however 16x16 in the top left corner of my message box's, open dialogs etc.
When I use setWindowIcon() on either my application or main window, it only ever uses the 16x16 icon. So in the taskbar it stretches it to 32x32 and is pixelated.
When I use an RC file, it only ever uses the 32x32 icon, which is scaled down in my message boxes etc and looks rubbish. Interestingly when using the RC file, my exe file in Windows explorer uses the correct icon depending on the size it has available, as desired.
All documents I have read online suggest that QT should look after this automatically. Just wondering if someone has come accross the same problem, or if you may have an idea of something to try?
To get around this issue I have set a different icon for my application and main window. All my application dialogs (i.e. message boxes) use the smaller icon, and the main window uses the larger icon for the taskbar. Far from ideal but seems to work thus far:
img = reader.read();
img = reader.read();
My only remaining issue is when I call QFileDialog::getOpenFileName() it takes the main window icon instead of the application dialog, regardless of whether i set its parent to "0" or "this". I have even tried changing the parent to the main windows parent (i.e. the application). It still takes the main windows icon!
Any suggestions? Is there a way to change the open dialogs icon manually?
I know that post is old, but it may help late readers like me.
bq. All documents I have read online suggest that QT should look after this automatically. Just wondering if someone has come accross the same problem, or if you may have an idea of something to try?
True, in fact it does. However, I think that the .ico imageformat plugin doesn't load multiple sizes or using the QIcon(const QString &) constructor assume that only one image can be read in the given file.
Here's a workaround to insert all sizes of an .ico file into a QIcon object (based on Fuzz1985 idea)
@QIcon readIcoFile(const QString & path)
This post is deleted!