Qt Serial Port
Qt Serial Port 该模块为配置、I/O 操作以及获取和设置 RS-232 引脚的控制信号提供了基本功能。
本模块不支持以下项目:
- 终端功能,如回音、控制 CR/LF 等。
- 数据传输的文本模式显示。
- 读取或写入时的超时和延迟配置。
- 改变引脚信号时的通知。
使用模块
使用 Qt 模块的 C++ API 需要直接或通过其他依赖关系与模块库链接。包括CMake和qmake 在内的多个构建工具都为此提供了专门支持。
使用 CMake 构建
使用find_package()
命令在Qt6
软件包中找到所需的模块组件:
find_package(Qt6 REQUIRED COMPONENTS SerialPort) target_link_libraries(mytarget PRIVATE Qt6::SerialPort)
更多详情,请参阅使用 CMake 构建概述。
使用 qmake 构建
要配置模块以便用 qmake 构建,可在项目的 .pro 文件中添加模块作为QT
变量的值:
QT += serialport
模块演变
Qt SerialPort 的变更列出了 Qt 6 系列对模块 API 和功能所做的重要变更。
相关信息
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.