您的位置:首页 > 编程语言 > Qt开发

Qt5.7设置应用程序图标-基于Windows

2017-02-08 09:56 253 查看
Setting the Application Icon on Windows
First, create an ICO format bitmap file that contains the icon image. This can be done with e.g. Microsoft Visual C++: Select File|New, then select the File tab in the dialog that appears, and choose Icon. (Note that you do not need to load your application
into Visual C++; here we are only using the icon editor.)

Store the ICO file in your application's source code directory, for example, with the name myappico.ico.

Then, assuming you are using qmake to generate your makefiles, you only need to add a single line to your .pro project file:

  RC_ICONS = myappico.ico

Finally, regenerate your makefile and your application. The .exe file will now be represented by your icon in Explorer.

However, if you already have an .rc file, for example, with the name myapp.rc, which you want to reuse, the following two steps will be required. First, put a single line of text to the myapp.rc file:

  IDI_ICON1               ICON    DISCARDABLE     "myappico.ico"

Then, add this line to your myapp.pro file:

  RC_FILE = myapp.rc

If you do not use qmake, the necessary steps are: first, create an .rc file and run the rc or windres program on the .rc file, then link your application with the resulting .res file. 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  qt5 图标