开发者

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开发者_如何学Python 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


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜