python 串口 上位机_QT学习教程一之串口上位机补充(源码均有注释)

在上一个上位机界面中忘记,对清空接收区和发送区的的按钮及暂停接收进行设置了,在这里进行补充一下。

```cpp

/************************************************

* @functionName:  on_btnClearRev_clicked()

* @date:          2020-07-17

* @description:   清空接收区

* @return:        Null

* @others:        Null

*************************************************/

void MMSerialPort::on_btnClearRev_clicked()

{

    ui->plainTextEdit_rev->clear();  // 清空接收区

}

/************************************************

* @functionName:  on_btnClearSend_clicked()

* @date:          2020-07-17

* @description:   清空发送区

* @return:        Null

* @others:        Null

*************************************************/

void MMSerialPort::on_btnClearSend_clicked()

{

    ui->plainTextEdit_send->clear(); // 清空发送区

}

/************************************************

* @functionName:  on_btnClearSend_clicked()

* @date:          2020-07-17

* @description:   暂停接收

* @return:        Null

* @others:        Null

*************************************************/

void MMSerialPort::on_btn_pause_rev_clicked()

{

    serial->close(); // 关闭串口

    ui->btnOpenPort->setEnabled(true);  // 将打开串口设置在使能状态

    ui->btnClosePort->setEnabled(false); //将关闭串口设置关闭

}

```

在串口助手中主要用到了下面几个控件:

QLabel 、QComboBOX、QPushButton、QGroupBox、QLCDNumber等,具体去工程里面查看,在这个里面用的直接转到槽,没有进行手写。

python 串口 上位机_QT学习教程一之串口上位机补充(源码均有注释)_第1张图片

若有错误,欢迎指正。

你可能感兴趣的:(python,串口,上位机)