parent
c67057f0f7
commit
920aaa4c8c
|
@ -1,6 +1,14 @@
|
|||
# Qt 使用技巧
|
||||
|
||||
## -platform
|
||||
- [Qt 使用技巧](#qt-使用技巧)
|
||||
- [1. -platform](#1--platform)
|
||||
- [2. QT\_DEBUG\_PLUGINS](#2-qt_debug_plugins)
|
||||
- [3. 添加图标](#3-添加图标)
|
||||
- [3.1. 制作图标](#31-制作图标)
|
||||
- [3.2. 添加图标到应用](#32-添加图标到应用)
|
||||
- [4. Windows 下程序的打包发布](#4-windows-下程序的打包发布)
|
||||
|
||||
## 1. -platform
|
||||
|
||||
在直行 Qt UI 程序时通过该参数可以直行所使用的平台和 UI 系统,如
|
||||
|
||||
|
@ -8,7 +16,7 @@
|
|||
./Example -platform wayland-egl
|
||||
```
|
||||
|
||||
## QT_DEBUG_PLUGINS
|
||||
## 2. QT_DEBUG_PLUGINS
|
||||
|
||||
在 Shell 中
|
||||
|
||||
|
@ -18,9 +26,9 @@ export QT_DEBUG_PLUGINS=1
|
|||
|
||||
可在直行程序时打印 PLUGINS 信息,以确认某些插件是否被正确加载。
|
||||
|
||||
## 添加图标
|
||||
## 3. 添加图标
|
||||
|
||||
### 制作图标
|
||||
### 3.1. 制作图标
|
||||
|
||||
先安装 ImageMagic 工具,并将其添加到系统 PATH 下方便使用。
|
||||
|
||||
|
@ -30,7 +38,7 @@ export QT_DEBUG_PLUGINS=1
|
|||
magick.exe convert icon-16.png icon-32.png icon-256.png myappico.ico
|
||||
```
|
||||
|
||||
### 添加图标到应用
|
||||
### 3.2. 添加图标到应用
|
||||
|
||||
在 Qt .pro 文件中添加以下内容,以便将图标编译到 Qt 程序中:
|
||||
|
||||
|
@ -54,7 +62,7 @@ If you do not use qmake, the necessary steps are: first, create an .rc file and
|
|||
|
||||
更详细内容见《[Setting the Application Icon](https://doc.qt.io/qt-5/appicon.html)》。
|
||||
|
||||
## Windows 下程序打包
|
||||
## 4. Windows 下程序的打包发布
|
||||
|
||||
Qt 提供了导出 Qt 环境变量的命令行脚本,比如“Qt 5.15.2 (MinGW 8.1.0 64-bit)”,运行该脚本可进入带有 Qt 环境变量的命令行界面,之后可通过如下命令打包程序(编译生成的可执行程序需要拷贝到\<Package Output Path\>):
|
||||
|
||||
|
|
Loading…
Reference in New Issue