90 lines
2.0 KiB
C++
90 lines
2.0 KiB
C++
#include "mainwindow.h"
|
||
#include "ui_mainwindow.h"
|
||
#include <QSerialPortInfo>
|
||
#include <QDebug>
|
||
#include <QMutex>
|
||
#include "Qss.h"
|
||
#include "libmodbus/modbus.h"
|
||
#include <math.h>
|
||
#include <QTimer>
|
||
#include <QFileDialog>
|
||
#include "global.h"
|
||
#include <subform.h>
|
||
|
||
#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;i<list3.size();i++){
|
||
qDebug()<<list3[i].portName();//
|
||
ui->comboBox_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(this->mForms.contains(ui->lineEdit_2->text())){
|
||
QMessageBox::warning(this,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD>","<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD>");
|
||
return;
|
||
}
|
||
SubForm *p1 = new SubForm(ui->lineEdit_2->text(),
|
||
ui->comboBox->currentText().toInt(),
|
||
ui->lineEdit_2->text().toInt());
|
||
qDebug()<<ui->lineEdit_2->text();
|
||
ui->tabWidget->addTab((QWidget*)p1,"<EFBFBD>豸<EFBFBD><EFBFBD>ַ:" + ui->lineEdit_2->text());
|
||
this->mForms[ui->lineEdit_2->text()] = p1;
|
||
|
||
if(nullptr == gAsyncData){
|
||
gAsyncData = new ASyncReadData(this);
|
||
connect(gAsyncData,&QSSASyncProcess::Done,[&](){
|
||
qDebug()<<"done";
|
||
});
|
||
|
||
}
|
||
|
||
// gAsyncData->AddConfig(new Config{
|
||
// QString(ui->comboBox_2->currentText()),
|
||
// ui->lineEdit_2->text().toInt(),
|
||
// ui->lineEdit_3->text().toInt(),
|
||
// });
|
||
|
||
}
|
||
|