当前位置:网站首页>QT weekly skills (3)~~~~~~~~~ serial port addition
QT weekly skills (3)~~~~~~~~~ serial port addition
2022-07-30 07:19:00 【transparent light】
前言
上次写了Qaction的添加,Make the interface look better,This time, add the serial port settings required by the project,This part is actually more like a gourd,别人怎么做,Just do it yourself.
第一节
Directly on the finished picture to see the effect,Continue below if necessary.
初始界面:
Click on the setting interface:
screen after connection:
点击下载后,The virtual serial port receives the data interface:
第二节
add points:
(1)Serial port element added;
(2)Serial port setting interface added;
(3)全局变量添加;
下面大概说一下:
串口:Serial port requiredclass已经包含在QT的库里面,所以可以直接调用函数.
添加位置:(1)profile to add the core file;
(2)mainwindowThe header file adds the serial port header file;串口类,分别为:
#include <QSerialPort>
QSerialPort *m_serial = nullptr;
(3)mainwindowThe main file adds class files,分别为:
m_serial(new QSerialPort)
串口设置界面:The serial port setting interface needs to be addedui工程,How to add this is described earlier.
添加位置:(1)mainwindowThe header file adds the serial port header file;分别为:
class serialset;
serialset *m_serialset = nullptr;
(2)mainwindowThe main file adds class files,分别为:
m_serialset(new serialset)
全局变量:Global variables are used in the same way as microcontrollers,After adding the correspondingclass删掉就行,然后在需要调用的A header file that contains global variables in the file will do.这样全部的A file can use a variable.Although in object-oriented programmingGlobal variables are discouraged,但是Don't stick to your frame,Most of the small partners should come from logic programming,You should be used to using global variables,Just remember where to change the parameters when you use it yourself.
结语
The following article will add a lot of serial port data processing and bit by bitcan数据处理方法,And use a simple screen to achieve.The program in the Baidu network disk is only the first time I have written itQTinterface is implemented,It's still a little bit bad now,So slowly improve the previous program,At the same time, add the problem of testing the number of serial ports received,For source code programs, please pay attention to the subscription number,Added Baidu network disk connection to the corresponding article in the subscription account,可以直接下载源代码.
The file cannot be sent due to the subscription number,So if you need source code, please leave a message.At the same time, the subscription account cannot send messages to the following friends first,You can only reply to the messages sent by your friends first,So friends who need source code, please leave a message in the public account.
边栏推荐
- QT每周技巧(3)~~~~~~~~~串口添加
- [Jiangsu University of Science and Technology Automation Association stm32F103c8t6] Notes [Initial 32 MCU and TIM timing interrupt initialization parameter configuration]
- About map custom sorting of keys
- Machine Learning, Deep Learning Based on MATLAB 2021b
- 点云统计滤波理解
- 【正点原子】IIC的学习与使用(未完...)
- OpenLayers 初学者指南,源码测试可用
- 边境的悍匪—机器学习实战:第五章 支持向量机
- 爬2.12.6的Antd上传图片坑
- QT serialization 1: readyRead() function, the solution to incomplete data subcontracting
猜你喜欢
边境的悍匪—机器学习实战:第五章 支持向量机
VsCode打开终端的方法
【江科大自化协stm32F103c8t6】笔记之【入门32单片机及EXTI外部中断初始化参数配置】
SSH-RSA密钥
[Jiangsu University Automation Association stm32F103c8t6] Notes [Initial 32 MCU and EXTI External Interrupt Initialization Parameter Configuration]
pdf和word等文档添加水印
[Jiangsu University Self-Chemistry Association stm32F103c8t6] Notes [Entry 32 MCU and GPIO initialization parameter configuration]
无法完成包的安装npm ERR! Refusing to install package with name “moment“ under a package also called “moment“
FPGA解析B码----连载1
influxDB运维记录
随机推荐
如何判断 PCB 板是否变形?
Application of remote sensing, GIS and GPS technology in hydrology, meteorology, disaster, ecology, environment and health
多层板的层数,为啥选项都是偶数?就不能选奇数?
工程师必看:常见的PCB检测方法有哪些?
给Vscode配置ESlint语法检查 — ESLint 插件自动格式化设置(实现Ctrl+S 按照ESLint规则自动格式化代码)
The application of Meta analysis in the field of ecological environment
[Punctuality Atom] Simple application of sys.c, sys.h bit-band operations
联影医疗一面
Kunlun state screen production (serial 3) - based article (button serial port to send)
删除当前路径下含某个关键字的所有文件
【江科大自化协stm32F103c8t6】笔记之【入门32单片机及GPIO初始化参数配置】
vs compile boost library script
clinit方法
BLDC电机应用持续火爆,“网红神器”筋膜枪前景几何?
OpenLayers (ol包),Vite显示地图(附源码)
CLUE Model Construction Method, Model Validation and Land Use Change Scenario Prediction
FPGA解析B码----连载1
QT串口动态实时显示大量数据波形曲线(四)========“界面的美化与处理”
昆仑通态屏幕制作(连载4)---基础篇(图形设定与显示,按钮灯)
ssh 脚本 空格字符转换