为QT生成的应用程序加图标
2013-04-28 18:47
363 查看
在QT帮助那里 查找 :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 the QWindow::setWindowIcon() method.
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++: 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.
1. 将你ICO的name.ICO,name.rc 放到qt工程那里
2.修改pro文件,加入 RC_FILE = name.rc
3.重新编译,OK
The application icon, typically displayed in the top-left corner of an application's top-level windows, is set by calling the QWindow::setWindowIcon() method.
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++: 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.
1. 将你ICO的name.ICO,name.rc 放到qt工程那里
2.修改pro文件,加入 RC_FILE = name.rc
3.重新编译,OK
相关文章推荐
- 为QT生成的应用程序加图标 \QWindow::setWindowIcon()
- QT窗口图标和生成exe应用程序图标设置
- 怎样设置Qt生成的应用程序图标
- Qt生成应用程序图标
- 怎样设置Qt生成的应用程序图标
- qt生成应用程序图标和托盘
- Qt4 设置应用程序图标
- QT 设置应用程序图标
- Qt中更改应用程序的图标
- 设置Qt应用程序图标
- Qt笔记——三步设置Qt应用程序图标
- 设置Qt应用程序图标
- Qt设置应用程序图标
- QT如何设置应用程序的图标
- 【转】设置Qt应用程序图标及应用程序名
- 设置Qt应用程序图标
- Qt应用程序的发布,exe文件图标设置
- VS下Qt应用程序图标和任务栏图标设置
- 设置Qt应用程序图标
- Qt应用程序添加图标