如何设置/更改应用程序图标? [英] How to set/change the application icon?

查看:68
本文介绍了如何设置/更改应用程序图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对设置应用程序图标感到困惑.
我看过很多关于设置应用程序图标的解释,但我还是不明白.
请我要一个简单的解释,但要一步一步来理解它

I'm Confused about set the application icon.
I have seen many explanations about set the application icon, but I'm still not understand.
Please I want a simple explanation, but step by step to understand it

我做了什么:
我创建了一个 Qt 资源文件(.qrc).
然后,我添加了一个前缀,然后我添加了图标文件.
然后,从设计模式和属性块中,我更改了一个名为 windowIcon 的属性.
然后我选择了之前在 .qrc 文件中添加的图标.

What I have done:
I have created a Qt resource file(.qrc).
Then, I have added a prefix, then I have added the Icon file.
Then, from design mode and from property block I have changed the a property called windowIcon.
Then I have selected the Icon which I added before in the .qrc file.

注意:我使用的是 Qt5.3 和 Windows 7.

Notice: I'm use Qt5.3 and windows 7.

现在,请问设置应用程序图标的正确步骤是什么?

推荐答案

您已经做了正确的事情来设置主窗口图标.只需在设计器中设置 windowIcon 属性,即可为应用程序窗口设置一个图标.

You have done the right thing to set the main window icon. Just setting windowIcon property in the designer will set an icon for the application window.

为了给应用程序可执行文件设置图标,Qt 5 中有一个自动化过程.

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

您可以将以下内容添加到 .pro 文件中:

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

win32: RC_ICONS = myIcon.ico

还将 .ico 文件存储在应用程序的源代码目录中.

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

请注意,这仅适用于 Windows.在 Linux 和 Mac 中还有其他设置应用程序图标的方法.

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

这篇关于如何设置/更改应用程序图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆