• 19266阅读
  • 7回复

怎样设置QT生成exe文件的ico图标呀? [复制链接]

上一主题 下一主题
离线xcykkk
 
只看楼主 倒序阅读 楼主  发表于: 2009-05-02
如题:
怎样设置QT生成exe文件的ico图标呀?
离线茶亭量子
只看该作者 1楼 发表于: 2009-05-03
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, create a text file called, say, myapp.rc in which you put a single line of text:

IDI_ICON1               ICON    DISCARDABLE     "myappico.ico"
Finally, assuming you are using qmake to generate your makefiles, add this line to your myapp.pro file:

RC_FILE = myapp.rc
Regenerate your makefile and your application. The .exe file will now be represented with your icon in Explorer.

If you do not use qmake, the necessary steps are: first, run the rc program on the .rc file, then link your application with the resulting .res file.
生命在于运动。
没有做不到,只有想不到。
http://hi.baidu.com/kernel_linux
离线xcykkk
只看该作者 2楼 发表于: 2009-05-03
回 1楼(茶亭量子) 的帖子
哦···
这个样子呀!
谢谢喽!!!
以后多多努力学习!
离线sulibin
只看该作者 3楼 发表于: 2009-05-04
呵呵,能不能翻译成中文,英文大部分看不懂
离线xcykkk
只看该作者 4楼 发表于: 2009-05-04
回 3楼(sulibin) 的帖子
这些英文,还是没有太多生僻的词汇呀!
不认识的,就查查!
离线long5337

只看该作者 5楼 发表于: 2009-05-04
我试了一下不错,谢了!
离线2010zhh
只看该作者 6楼 发表于: 2010-11-16
回 1楼(茶亭量子) 的帖子

1、先要自己准备一个ico类型的图标文件,通常我们下载到的图标库大多是png类型的,因此,可以去下载一个转换工具,这类工具也很好找,vc自带的工具也可以生成ico文件,这里建议如果有png图标的朋友可以去greendown.cn去下载一个叫做ToYcon的工具,操作很简单。(PS:你没听过greendown?那你out了 呵呵)
2、将ico文件拷贝到你的源码目录,新建一个名为myapp.rc的文件(其他的名字也可以,但后缀必须是rc,和vs开发时的资源文件一样),在其中写入如下内容:
IDI_ICON1               ICON    DISCARDABLE     "myappico.ico"
上面的ico文件名根据自己的实际情况填写,保存退出
3、在qt项目的pro文件中添加一行:
RC_FILE = myapp.rc
4、用qmake或者creator重新build你的工程就该可以了


PS:该方法在qt4.6 Windows平台上测试可行
离线wuweihua0115
只看该作者 7楼 发表于: 2012-07-16
回 6楼(2010zhh) 的帖子
为什么我实现不了呀?????
快速回复
限100 字节
 
上一个 下一个