当前位置:网站首页>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
边栏推荐
- [UDS unified diagnosis service] i. diagnosis overview (2) - main diagnosis protocols (K-line and can)
- [UDS unified diagnostic service] IV. typical diagnostic service (2) - data transmission function unit
- MOS管特性和导通过程
- 【UDS统一诊断服务】一、诊断概述(4)— 基本概念和术语
- 猜数字游戏
- 【UDS统一诊断服务】四、诊断典型服务(5)— 功能/元件测试功能单元(例行程序功能单元0x31)
- 【UDS统一诊断服务】四、诊断典型服务(6)— 输入输出控制单元(0x2F)
- [learn] HF net training
- Eigen 学习总结
- 【UDS统一诊断服务】四、诊断典型服务(4)— 在线编程功能单元(0x34-0x38)
猜你喜欢
![[UDS unified diagnosis service] i. diagnosis overview (2) - main diagnosis protocols (K-line and can)](/img/ec/9b783b6dca5684684485e3b9fc6846.png)
[UDS unified diagnosis service] i. diagnosis overview (2) - main diagnosis protocols (K-line and can)

CUDA环境安装

Detailed arrangement of knowledge points of University probability theory and mathematical statistics

Dynamic creation and release, assignment and replication of objects

Initialization of classes and objects (constructors and destructors)

【UDS统一诊断服务】四、诊断典型服务(5)— 功能/元件测试功能单元(例行程序功能单元0x31)

Collection of practical tips for C language (continuously updated)

【UDS统一诊断服务】一、诊断概述(2)— 主要诊断协议(K线和CAN)

copy constructor

基于Keras的时装分类案例
随机推荐
搭建jpress个人博客
类和对象的初始化(构造函数与析构函数)
共用数据的保护
FOC SVPWM函数PWMC_SetPhaseVoltage解析
_findnext 报错
C语言的运算符
Graduation project, viewing screenshots of epidemic psychological counseling system
生成验证码
【UDS统一诊断服务】四、诊断典型服务(1)— 诊断和通信管理功能单元
Camera calibration: key point method vs direct method
死区时间的分析与设置
[UDS unified diagnostic service] IV. typical diagnostic service (5) - function / component test function unit (routine function unit 0x31)
利用文件保存数据(c语言)
四元数乘法
Programmers can also write novels
gcc ,g++,gdb的安装
grub boot. S code analysis
[UDS unified diagnosis service] i. diagnosis overview (3) - ISO 15765 architecture
[UDS unified diagnostic service] II. Network layer protocol (1) - overview and functions of network layer
[opencv] use filestorage to read and write eigenvectors