求助QT设置应用程序图标的问题

求助QT设置应用程序图标的问题,第1张

qt的版本,是4还是5。你可以查看assistant中的

Setting the Application Icon

里面有详细的设置应用程序图标的说明。

First, create an ICO format bitmap file that contains the icon image This can be done with eg 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 myappicoico

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 = myappicoico

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 myapprc, which you want to reuse, the following two steps will be required First, put a single line of text to the myapprc file:

IDI_ICON1 ICON DISCARDABLE "myappicoico"

Then, add this line to your myapppro file:

RC_FILE = myapprc

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

首先,你需要创建一个包含图标的ICO格式的位图文件。VC下:选择 文件|新建,选择对话框中的文件标签,再选择ICON。

将ICO文件保存在程序源代码的目录下,比如命名为myappicoico

假设你使用qmake来生成makefiles文件,你只需要在pro文件中添加一行:

RC_ICONS = myappicoico

最后,重新生成makefile和应用程序。然后,exe文件就会显示你设置的图标了。

不过,如果你已经有了一个rc文件的话,比如myapprc,添加下面的两行。首先,在myapprc中添加一行:

IDI_ICON1 ICON DISCARDABLE "myappicoico"

然后在pro中添加一行:

RC_FILE = myapprc

如果你用的不是qmake,必要的步骤有:首先,创建一个rc文件,然后运行rc或者windres程序,最后将你的应用程序和res文件链接在一块就行了。

>

具体依赖于编译器。部分编译器不支持exe图标更改。

以VC为例:

1 打开工程。

2 新建文件,选择resource类型文件(资源类)。

3 选择add resource(新增资源)。

4 选择icon(图标)。

5 选择一个ico文件导入。ico即图标文件。可以选择系统自带的,也可以自己制作。

6 编译工程。会发现exe的图标已经更换了。

补充说明:已经生成的exe文件无法修改图标我用的是qt creator,修改的方法是:

首先准备个ico图标。例如:aico,网上有很多图标文件。

用记事本新建个txt

里面就写一行:

idi_icon1 icon discardable "aico"

保存,修改后缀为rc,例如: myapprc

把它和图标aico一起复制到你的qt工程项目的目录。

打开你的qt工程文件pro(例如 "myapppro" ),

在里面最后新添一行

rc_file = myapprc

保存,重新编译你的工程。

如果想换图标,就重换一个图标,重命名为aico替换原来的,重新编译就可以了。

以上就是关于求助QT设置应用程序图标的问题全部的内容,包括:求助QT设置应用程序图标的问题、qt中添加资源文件的方法_程序中所用到全部图标、Qt中,怎么修改生成的EXE文件的图标和名字等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zz/10633196.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-10
下一篇 2023-05-10

发表评论

登录后才能评论

评论列表(0条)

保存