QSerialPort使用详解
(2013-03-26 22:14:47)
标签:
qt串口串口通信qserialportit |
= 关于QextSerialPort =
QextSerialPort为Qt应用程序提供了串口的接口.它目前支持以下平台:Mac OS X, Windows, Linux, FreeBSD。
官方地址:http://code.google.com/p/qextserialport/
== 使用方法 (1) ==
* 下载源代码.
* 把源代码放在你都文件夹下。例如, 3rdparty:
|-- project.pro
|-- ....
|-- 3rdparty\
|
|-- qextserialport\
|
|
* 把下面这句代码加入到你都Qt工程文件(.pro)中:
include(3rdparty/qextserialport/src/qextserialport.pri)
* 在你的代码中使用QextSerialPort。Enjoy it!
#include "qextserialport.h"
....
QextSerialPort * port = new QextSerialPort();
....
== 使用方法(2) ==
虽然使用上面都方法很容易就把QextSerialPort编译到你都Qt程序中了,但是, 我们更喜欢使用库文件。
下面介绍把QextSerialPort编译成库文件使用的方法。
* 下载源代码,随意把它放在你喜欢的地方.
* 进入该文件夹,执行下面都命令(根据你所使用都平台选择命令).
qmake
make (or nmake)
sudo make install (or nmake install)
* 在你的Qt工程文件中加入以下代码
CONFIG += extserialport
* 在你的代码中使用QextSerialPort。 Enjoy it!
#include "qextserialport.h"
....
QextSerialPort * port = new QextSerialPort();
....
== 编译文档 ==
* 执行
QextSerialPort为Qt应用程序提供了串口的接口.它目前支持以下平台:Mac OS X, Windows, Linux, FreeBSD。
官方地址:http://code.google.com/p/qextserialport/
== 使用方法 (1) ==
== 使用方法(2) ==
虽然使用上面都方法很容易就把QextSerialPort编译到你都Qt程序中了,但是, 我们更喜欢使用库文件。
下面介绍把QextSerialPort编译成库文件使用的方法。
== 编译文档 ==