补充 添加图标 方法.
Signed-off-by: lion.chan <cy187lion@sina.com>
This commit is contained in:
parent
85b514bfaa
commit
ef2ad69132
|
@ -18,6 +18,42 @@ export QT_DEBUG_PLUGINS=1
|
|||
|
||||
可在直行程序时打印 PLUGINS 信息,以确认某些插件是否被正确加载。
|
||||
|
||||
## 添加图标
|
||||
|
||||
### 制作图标
|
||||
|
||||
先安装 ImageMagic 工具,并将其添加到系统 PATH 下方便使用。
|
||||
|
||||
使用以下命令将多个不同尺寸的图片打包成一个 ICO 文件。
|
||||
|
||||
```sh
|
||||
magick.exe convert icon-16.png icon-32.png icon-256.png myappico.ico
|
||||
```
|
||||
|
||||
### 添加图标到应用
|
||||
|
||||
在 Qt .pro 文件中添加以下内容,以便将图标编译到 Qt 程序中:
|
||||
|
||||
```sh
|
||||
RC_ICONS = myappico.ico
|
||||
```
|
||||
|
||||
However, if you already have an .rc file, for example, with the name myapp.rc, which you want to reuse, the following two steps will be required. First, put a single line of text to the myapp.rc file:
|
||||
|
||||
```sh
|
||||
IDI_ICON1 ICON "myappico.ico"
|
||||
```
|
||||
|
||||
Then, add this line to your myapp.pro file:
|
||||
|
||||
```sh
|
||||
RC_FILE = myapp.rc
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
更详细内容见《[Setting the Application Icon](https://doc.qt.io/qt-5/appicon.html)》。
|
||||
|
||||
## Windows 下程序打包
|
||||
|
||||
可通过
|
||||
|
|
Loading…
Reference in New Issue