Злой Дядька в сети — 2017

Setting a custom icon for application using Qt

15 February 2017 (17:12:13)

It's very easy to set an icon for a running application:

QApplication::setWindowIcon( QIcon( "myapp.ico" ) );

But here's the problem - in Windows Explorer we still see our executable file with a standard average scall icon. Let's fix it. First, create a file myapp.rc with the folloing content:

IDI_ICON1 ICON DISCARDABLE "./myapp.ico"

Then append the folloing line to your project file (.pro):

win32: RC_FILE = myapp.rc

Now the executable file will have a beautiful icon after rebuild of application.

This method works fine only for Windows. There are such techniques for other platforms and I'll write about them later.

Отзовик - пишите отзывы и получайте деньги!