#include "mainwindow.h" #include "ui_mainwindow.h" #include #include #include #include "Qss.h" #include "libmodbus/modbus.h" #include #include #include #include "global.h" #include #if defined(_MSC_VER) && (_MSC_VER >= 1600) # pragma execution_character_set("utf-8") #endif MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) , mStart(false) , mConfig(nullptr) { ui->setupUi(this); auto list3 = QSerialPortInfo::availablePorts(); for(int i=0;icomboBox_2->addItem(list3[i].portName()); } ui->comboBox->addItem("2400"); ui->comboBox->addItem("4800"); ui->comboBox->addItem("9600"); ui->comboBox->addItem("57600"); ui->comboBox->addItem("115200"); } MainWindow::~MainWindow() { delete ui; } void MainWindow::init_charts() { } void MainWindow::on_pushButton_2_clicked() { } void MainWindow::on_pushButton_clicked() { } void MainWindow::on_pushButton_3_clicked() { if(nullptr == gAsyncData){ gAsyncData = new ASyncReadData(this); connect(gAsyncData,&QSSASyncProcess::Done,[&](){ qDebug()<<"done"; }); qDebug()<<"hello world"; gAsyncData->Start(nullptr); } if(this->mForms.contains(ui->lineEdit_2->text())){ QMessageBox::warning(this,"�����Ѿ���","�����Ѿ���"); return; } SubForm *p1 = new SubForm(ui->comboBox_2->currentText(), ui->comboBox->currentText().toInt(), ui->lineEdit_2->text().toInt(), ui->lineEdit_3->text().toInt()); qDebug()<lineEdit_2->text(); ui->tabWidget->addTab((QWidget*)p1,"address:" + ui->lineEdit_2->text()); this->mForms[ui->lineEdit_2->text()] = p1; }