当前位置:网站首页>多种Qt的开发方式,你选择哪种?
多种Qt的开发方式,你选择哪种?
2022-06-12 16:55:00 【yinchengkai】
qt值得学习吗?
嵌入式要学的东西真的很多,我们可能会说不写界面的话就不用学qt了?我不赞同。
Qt的实现主要是采用p-impl手法,实现接口与实现分离,它有很好的消息循环机制,有的对象与线程的相关性,它也有借助moc生成反射元信息,这种设计方法至今仍然非常适用。
qt内核部分其实是完全和界面无关的,你完全可以抛开Qt GUI部分来学习和使用Qt。当你完完全全学习了qt及其理念后,你会发现写优雅的代码是一件十分简单的事情,它可以应用到你之后的所有过程中去。
那么哪种Qt开发方式较好或者容易入门呢?
QT做UI界面一般单纯使用C++硬编码的方式,可以直接采用QWidget部件来做,而不是采用QT Designer做UI界面,也不是采用QML+Javascript,虽然灵活但是这样的话代码量大,通常采用QT开发,有如下三种方式:
使用QT GUI框架,单纯硬编码
使用QT Designer做UI界面,类似于MFC一样拖控件,然后再使用C++写逻辑。
采用QML做UI,JavaScript写逻辑,C++写后台,三种语言混合编程。
那么Qt常见的有多少种开发方式呢?一般情况下分为下面2种
第一种:纯QtCreator方式,QtCreator编码+MinGW或MSVC或其他编译。
第二种:VS+Qt库,把Qt当成一个界面库来在VS中调用。VS编码+MSVC编译。

使用VS+Qt的正确打开方式
如果开发的程序只管windows上跑,不用跨平台,也不关心是否需要使用Qt Creator打开,那么推荐你使用VS+Qt方式进行开发。
这种情况需要安装VS、Qt软件,并且在VS中安装QT插件,配置环境变量等等,具体的安装配置教程大家可以参考网上的,亲手尝试一下,本文注重方法。

装好重新打开VS,菜单栏多出个QT VS Tools,点击QT Options可以进行下一步操作

VS速度和调试功能完爆Qt Creator,开发起来很爽。
使用Qt Creator的打开方式
QtCreator+MSVC
需要安装VS(我们主要使用它的编译器)、Qt Creator软件,MSVC调试器安装,通过windows SDK工具安装调试器。配置Qt Creator编译器和调试器
打开Qt Creator,选择“工具”->“选项”,再选择“Kits”->“编译器”,可以看到Qt已经自动检测到MSVC编译器了。

同时在“Kits”->“Debuggers”下,也自动检测到调试器了。

然后我们选择“Kits”->“构建套件”,然后选择Desktop Qt 5.12.0 MSVC2017 64bit,
配置C/C++编译器均为:Microsoft Visual C++ Compiler 15.0(x86_amd64);
配置调试器为:Auto-detected CDB at D:\Windows Kits\10\Debuggers\x64\cdb.exe。

Qt Creator+MinGW
安装Qt creator后,直接使用Qt Creator编码,使用自带的MinGW编译,这个是最简单的,无需外界其他任何辅助。
同时安装步骤也是最简单的,直接装完就可以做开发,没有过多的配置过程。

推荐使用QtCreator+MSVC方式,在速度和跨平台都占优,调试功能稍弱,另外这种方式不存在工程转换的问题,可以更好的支持跨平台开发。
结论
如果需要考虑跨平台,那么最好不要使用VS+Qt这种方式,工程转换路径、库、配置有很多麻烦的地方;
MSVC在编译速度和运行速度上都完爆MinGW,不推荐使用MinGW编译,这个大家体验一下就知道了。
‧‧‧‧‧‧‧‧‧‧‧‧‧‧‧‧ END ‧‧‧‧‧‧‧‧‧‧‧‧‧‧‧‧
边栏推荐
- [MySQL] Cartesian product - multi table query (detailed explanation)
- The safety of link 01 was questioned, and "ultra high strength" became "high strength"_ Publicity_ Steel_ problem
- 博士申請 | 新加坡國立大學Xinchao Wang老師招收圖神經網絡方向博士/博後
- 价值超高的CA证书解析
- Golang recursively encrypts and decrypts all files under the specified folder
- How to do a good job of testing in the company (do a good job of testing)
- Swin transformer code explanation
- [Hunan University] information sharing of the first and second postgraduate entrance examinations
- Some minor problems and solutions encountered when using ubantu
- 反馈式编译
猜你喜欢

QCustomplot笔记(一)之QCustomplot添加数据以及曲线

uabntu的sudo

What's the matter with pbootcms' if judgment failure and direct display of labels?

Gerrit+2触发Jenkins任务

Uniapp wallpaper applet source code / double ended wechat Tiktok applet source code

Unit sshd. service could not be found

Sudo of uabntu

Su directly switches to super administrator mode, so that many error reports can be avoided

Recommend AI intelligent drawing repair software

Modify the configuration of the router connected to your computer. The website is 192.168.1.1
随机推荐
Qcustomplot notes (I): qcustomplot adding data and curves
[MySQL] internal connection, external connection and self connection (detailed explanation)
idea如何设置导包不带*号
Large scale real-time quantile calculation -- a brief history of quantitative sketches
【湖南大学】考研初试复试资料分享
PAT甲级 1139 第一次接触
(三)Golang - 数据类型
Play kubernetes every 5 minutes summary
Pat class a 1142 largest regiment
添加静态路由
Modify the configuration of the router connected to your computer. The website is 192.168.1.1
Contract awarding and AQS
Idea displays services on the console to uniformly manage all jetty services,
SwinTransformer网络架构
初识GO语言
What is compound interest financial product?
使用ubantu时,遇见的一些小毛病和解决方法
怎么在公司里面做好测试工作(做好测试工作)
Is the securities account opened by qiniu safe? Is it legal?
\Begin{algorithm} notes