Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QApplication::setWindowIcon works on Windows XP, but does not work on Windows 7

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?

like image 256
Ilya Avatar asked Oct 25 '13 10:10

Ilya


1 Answers

Similar question is .ico icons not showing up on Windows. Solution is simple:

  • create directory imageformats in application dir,
  • copy 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.

like image 53
Ilya Avatar answered Oct 27 '22 01:10

Ilya