Qt:程序桌面图标生成
2016-07-01 16:54
369 查看
Setting the Application Icon
The application icon, typically displayed in the top-left corner of an application's top-level windows, is set by calling theQWidget::setWindowIcon()method on top-level widgets.
In order to change the icon of the executable application file itself, as it is presented on the desktop (i.e., prior to application execution), it is necessary to employ another, platform-dependent
technique.
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++: SelectFile|New, then select the File tabin 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.
相关文章推荐
- qt-creator源码研究2
- VS2010与QT的集成开发环境
- QThread多线程编程经典案例分析
- QT在windows下的安装
- QT中窗口刷新事件的学习总结
- QT 网络编程
- 用QT 写的一个Log
- QTableview QSqlTableModel如何最恰当地只显示一个表中的某几个字段的数据
- QT延时:阻塞延时与非阻塞延时
- qt-creator源码研究与调试
- qt捕获全局windows消息
- Qt之QThread
- Qt之QThread
- QT 5.0.2 Install On Ubuntu12.04 (x86_64)
- QTableWidget去除选中虚边框
- Qt容器类
- qt creator 快捷操作
- QT creator+OpenCV2.4.2+MinGW 在windows下开发环境配置
- 用QtWebKit开发简单的浏览器
- 用QtWebKit开发简单的浏览器