当前位置:网站首页>QT add qserialport class to realize serial port operation
QT add qserialport class to realize serial port operation
2022-04-23 06:43:00 【~Ha】
- Preface
I've been studying recently Qt, I want to be a serial assistant . But when adding two header files related to the serial port (QSerialPort、QSerialPortInfo) The file doesn't exist all the time , Know that there are two files related to the local serial port , I also read many online tutorials , But I just can't get it right , For a long time . This is a post , Prevent the majority of beginners from having the same confusion in the future . This tutorial is suitable for Qt All versions , Installing other classes can also be used as a reference
- Environmental Science
System :win10
Qt edition :5.14.0
- Installation steps
One 、 Download related files
First, you need to download relevant files on the official website , However, due to the slow download of the official website , Therefore, it is recommended to use domestic image source . Here I use the mirror image of Tsinghua University https://mirrors.tuna.tsinghua.edu.cn/, Search for qt, open official_release( Some official codes , Tools )

next open qt Folder , Here you can choose the version , Install on your own computer qt Just select the version of
Select the version and then open submodules Folder , Slide down , Find the serial port related files, as shown in the figure below , download

Two 、 install
Unzip and open the project , Open the project configuration page

It opens at build The steps of the make Column details , stay Make arguments(make Parameters ) Fill in the install, The choice here is release The way ,debug The same way of operation
Then compile the whole project , In this way, these two classes are installed on the computer , It can be used for other projects
- 3、 ... and 、 The last step
Open the serial port project , Contains these two header files
#include <QSerialPort> // Provides the function of accessing the serial port
#include <QSerialPortInfo> // Provide the information of the serial port in the system
At this time, an error will still be reported that the file cannot be found , This is normal , Still need to be in .pro Add a line of code to the file
QT +=serialport
At this point, you can normally use the classes and methods related to the serial port
版权声明
本文为[~Ha]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230548244901.html
边栏推荐
- Cross domain issues - allow origin header contains multiple values but only one is allowed
- 卷积神经网络实现CIFAR100数据集分类
- Matching between class template with default template argument and template parameter
- 基于VGG对五种类别图片的迁移学习
- [UDS unified diagnostic service] i. overview of diagnosis (4) - basic concepts and terms
- [UDS unified diagnosis service] i. diagnosis overview (3) - ISO 15765 architecture
- TensorFlow张量介绍
- 【UDS统一诊断服务】五、诊断应用示例:Flash Bootloader
- ArcGIS license错误-15解决方法
- WMI技术介绍和应用
猜你喜欢

clion安装教程

Graduation project, viewing screenshots of epidemic psychological counseling system
[ThreadX] h743 + ThreadX + Filex migration record

【UDS统一诊断服务】二、网络层协议(2)— 数据传输规则(单帧与多帧)

Opencv uses genericindex for KNN search

拷贝构造函数

C语言循环结构程序

Qt 添加QSerialPort类 实现串口操作

【UDS统一诊断服务】五、诊断应用示例:Flash Bootloader
![[UDS unified diagnosis service] i. diagnosis overview (3) - ISO 15765 architecture](/img/ef/173281ffb354b9abe1b730b89469cc.png)
[UDS unified diagnosis service] i. diagnosis overview (3) - ISO 15765 architecture
随机推荐
PM2 deploy nuxt project
圆整 round 的一点点小细节
GDB debugger installation and use
逻辑回归原理及代码实现
C#【文件操作篇】按行读取txt文本
生成验证码
Call procedure of function
realsense 选型大对比D455 D435i D415 T265 3D硬件对比
日志写法(带时间)
类的继承与派生
C语言数组处理批量数据
对象的动态建立和释放,赋值和复制
TensorFlow张量介绍
Wechat applet request encapsulation
Introduction to nonparametric camera distortion model
Notes on advanced points of C language 2
SSH 公钥 私钥的理解
1006 finding a mex (hdu6756)
【无标题】
C语言进阶要点笔记4