In a simple Qt application starting like this:
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
app.setWindowIcon(QIcon(":/qapp/appicon.ico"));
...
we set the icon in the second line (this line and icon file in resources is the only difference between my test program and application generated by Qt wizard). This application works perfect on Windows XP, but on Windows 7 we can't see our icon in top-left corner of the window (system shows default icon instead of my appicon.ico).
Configuration of developer's computer:
- Windows XP-SP3,
- Qt 5.1,
- MSVS2010-SP1.
UPDATE:
Operating system of developer is Windows XP, so we have temporary answer. When we compiled this application on computer with Windows 7, the problem disappeared (application shows the icon correctly on WinXP and Win7). So now we have to compile releases of this application on Windows 7. But it does not looks like perfect solution.
Do you have any ideas, how to solve this problem better?
Similar question is .ico icons not showing up on Windows. Solution is simple:
imageformats
in application dir,qico.dll
in it.Without this plugin QIcon can't read .ico files. So the problem was not in Windows 7 and Windows XP. The problem was in default paths variables on different computers.
My guess is you've got to create a resource file
windows_icon.rc
with the following content:and add this line to your app's .pro file:
This is the way you set the app icon on Windows (the one that becomes the icon of the exe-file)