1、配置串口
this->myserial->setPortName("COM1");//待打开的串口号
this->myserial->setBaudRate(9600,QSerialPort::AllDirections);//设置波特率;QSerialPort::AllDirections:双工
this->myserial->setDataBits(QSerialPort::Data8);//数据位
this->myserial->setParity(QSerialPort::NoParity);//校验位
this->myserial->setStopBits(QSerialPort::OneStop);//停止位
this->myserial->setFlowControl(QSerialPort::NoFlowControl);//流控制
this->myserial->open(QIODevice::ReadWrite);//打开串口
原文:http://www.cnblogs.com/judes/p/6664782.html