QT | 第一个QT程序
1.运行QT Createor
更换QT Creater主题
2.新建工程
选择"文件(F)
->新建文件或者项目(N)...
"。
GUI设计工具
3.运行效果
4.问题
问题1:单独点击"hello.exe
"可执行文件,报错:
解决办法:
无法启动此程序,因为计算机中缺少Qt5Core.dll。
因为该可执行程序下缺少依赖的库,或者是正确的环境变量;
打开QT 5.9 for Desktop(MinGW 5.3.0 32 bit)
程序,执行如下操作即可(windeployqt hello.exe
)。
Setting up environment for Qt usage...
C:\01_SW\01_DesTools\16_QT\5.9\mingw53_32>D:\05_Study\mark-down-doc\09-QT\demo-src\demo-hello\build-hello-Desktop_Qt_5_9_0_MinGW_32bit-Debug\debug
'D:\05_Study\mark-down-doc\09-QT\demo-src\demo-hello\build-hello-Desktop_Qt_5_9_0_MinGW_32bit-Debug\debug' 不是内部或外 部命令,也不是可运行的程序
或批处理文件。
C:\01_SW\01_DesTools\16_QT\5.9\mingw53_32>cd D:\05_Study\mark-down-doc\09-QT\demo-src\demo-hello\build-hello-Desktop_Qt_5_9_0_MinGW_32bit-Debug\debug
C:\01_SW\01_DesTools\16_QT\5.9\mingw53_32>d:
D:\05_Study\mark-down-doc\09-QT\demo-src\demo-hello\build-hello-Desktop_Qt_5_9_0_MinGW_32bit-Debug\debug>windeplogqt hello.exe
'windeplogqt' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
D:\05_Study\mark-down-doc\09-QT\demo-src\demo-hello\build-hello-Desktop_Qt_5_9_0_MinGW_32bit-Debug\debug>windeployqt hello.exe
D:\05_Study\mark-down-doc\09-QT\demo-src\demo-hello\build-hello-Desktop_Qt_5_9_0_MinGW_32bit-Debug\debug\hello.exe 32 bit, debug executable
Adding Qt5Svg for qsvgicond.dll
Skipping plugin qtvirtualkeyboardplugind.dll due to disabled dependencies.
Direct dependencies: Qt5Core Qt5Widgets
All dependencies : Qt5Core Qt5Gui Qt5Widgets
To be deployed : Qt5Core Qt5Gui Qt5Svg Qt5Widgets
Updating Qt5Cored.dll.
Updating Qt5Guid.dll.
Updating Qt5Svgd.dll.
Updating Qt5Widgetsd.dll.
Updating libGLESV2d.dll.
Updating libEGLd.dll.
Updating D3Dcompiler_47.dll.
Updating opengl32sw.dll.
Updating libgcc_s_dw2-1.dll.
Updating libstdc++-6.dll.
Updating libwinpthread-1.dll.
Patching Qt5Cored.dll...
Creating directory D:/05_Study/mark-down-doc/09-QT/demo-src/demo-hello/build-hello-Desktop_Qt_5_9_0_MinGW_32bit-Debug/debug/iconengines.
Updating qsvgicond.dll.
Creating directory D:/05_Study/mark-down-doc/09-QT/demo-src/demo-hello/build-hello-Desktop_Qt_5_9_0_MinGW_32bit-Debug/debug/imageformats.
Updating qgifd.dll.
Updating qicnsd.dll.
Updating qicod.dll.
Updating qjpegd.dll.
Updating qsvgd.dll.
Updating qtgad.dll.
Updating qtiffd.dll.
Updating qwbmpd.dll.
Updating qwebpd.dll.
Creating directory D:/05_Study/mark-down-doc/09-QT/demo-src/demo-hello/build-hello-Desktop_Qt_5_9_0_MinGW_32bit-Debug/debug/platforms.
Updating qwindowsd.dll.
Creating D:\05_Study\mark-down-doc\09-QT\demo-src\demo-hello\build-hello-Desktop_Qt_5_9_0_MinGW_32bit-Debug\debug\translations...
Creating qt_bg.qm...
Creating qt_ca.qm...
Creating qt_cs.qm...
Creating qt_da.qm...
Creating qt_de.qm...
Creating qt_en.qm...
Creating qt_es.qm...
Creating qt_fi.qm...
Creating qt_fr.qm...
Creating qt_gd.qm...
Creating qt_he.qm...
Creating qt_hu.qm...
Creating qt_it.qm...
Creating qt_ja.qm...
Creating qt_ko.qm...
Creating qt_lv.qm...
Creating qt_pl.qm...
Creating qt_ru.qm...
Creating qt_sk.qm...
Creating qt_uk.qm...
D:\05_Study\mark-down-doc\09-QT\demo-src\demo-hello\build-hello-Desktop_Qt_5_9_0_MinGW_32bit-Debug\debug>
5.打包程序
下载Enigma Virtual Box并安装;
https://enigmaprotector.com/en/downloads.html
6.更换图标
6-1.将图标拷贝到源码目录下
6-2.在.pro项目文件中添加一行代码:RC_ICONS = myico.ico
6-3.重新编译工程,运行效果
7.拓展
2.QT下载
https://mirrors.tuna.tsinghua.edu.cn/qt/archive/qt/5.9/5.9.0/qt-opensource-windows-x86-5.9.0.exe
3.图解Qt安装(Windows平台)