加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
setupserial.cpp 1.46 KB
一键复制 编辑 原始数据 按行查看 历史
panda 提交于 2018-06-07 17:46 . 串口调试助手
#include "setupserial.h"
#include "ui_setupserial.h"
#include "serialinfo.h"
#include <QDebug>
SetupSerial::SetupSerial(Serialworks *work,QString com,int bitrate,int parity, QDialog *parent) :
m_works(work),
_com(com),
_bitrate(bitrate),
_parity(parity),
QDialog(parent),
ui(new Ui::SetupSerial)
{
ui->setupUi(this);
setWindowTitle("Setup");
setWindowFlags(Qt::WindowCloseButtonHint | Qt::Drawer);
_isChanged = false;
SerialInfo info;
ui->comboBox->insertItems(0,info.comList());
ui->comboBox->setCurrentText(_com);
ui->comboBox_2->setCurrentText(QString::number(_bitrate));
ui->comboBox_5->setCurrentIndex(_parity);
connect(this,SIGNAL(signal_com_param(QString,int,int)),m_works,SLOT(slot_com_param(QString,int,int)));
}
SetupSerial::~SetupSerial()
{
delete ui;
}
void SetupSerial::on_btnOk_clicked()
{
if(ui->comboBox->currentText()!=_com){
_com = ui->comboBox->currentText();
_isChanged = true;
}
if(ui->comboBox_2->currentText().toInt()!= _bitrate){
_bitrate = ui->comboBox_2->currentText().toInt();
_isChanged = true;
}
if(ui->comboBox_5->currentIndex()!= _parity){
_parity = ui->comboBox_5->currentIndex();
_isChanged = true;
}
if(_isChanged){
emit signal_com_param(_com,_bitrate,_parity);
}
accept();
}
void SetupSerial::on_btnCancel_clicked()
{
reject();
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化