user451498
user451498

Reputation:

Base icon for a Qt application

My problem is simple.

How do I add an icon that appears in Windows Explorer ?

Not the specific window I want the whole application like the command prompt has the C:\ on the icon.

Is there any way I can do that without creating files and linking it to the .pro file ?

Can I change that base icon in the Qt Creator ?

If so, how ? If not how do I do it otherwise ?

Thank you

PS I have tried the other questions out there and none of them work at all

Upvotes: 2

Views: 451

Answers (2)

Nejat
Nejat

Reputation: 32685

In Qt 4, you need to create a .rc file like this:

IDI_ICON1 ICON DISCARDABLE "myIcon.ico"

You should add this to your .pro file :

win32: RC_FILE += MyApp.rc

In Qt 5 there is an automated process for setting an icon to the application executable file .

You can just add the following to the .pro file:

win32: RC_ICONS = myIcon.ico

Also store the .ico file in your application's source code directory.

Note that this is only for Windows. There are other ways to set application icon in Linux and Mac.

Upvotes: 0

Symbiosoft
Symbiosoft

Reputation: 4711

Basicaly, on Windows, you have to create an .rc file for your icon and then add a line in you .pro file for it :

  RC_FILE = myapp.rc

All the details are available in Qt Documentation: Setting the Application Icon

Upvotes: 5

Related Questions