完成数据变化绘图

This commit is contained in:
2024-09-18 16:18:36 +08:00
parent 14d80194c5
commit c9e2c5a72f
8 changed files with 59 additions and 39 deletions

View File

@ -8,7 +8,7 @@
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow), readThread(new ReadThread), customTime(new CustomTime) {
: QMainWindow(parent), ui(new Ui::MainWindow), readThread(new ReadThread), customTime(new CustomThread) {
ui->setupUi(this);
// 创建版本号标签并添加到状态栏的右端
QLabel *m_versionLabel = new QLabel(tr("v1.2.0"), this);
@ -26,9 +26,9 @@ MainWindow::MainWindow(QWidget *parent)
connect(readThread, &ReadThread::closeProg, this, &MainWindow::closeProg);
//customTime
connect(customTime, &CustomTime::setProgressBar, this, &MainWindow::setProgressBar);
connect(customTime, &CustomTime::setPlotView, this, &MainWindow::setPlotView);
connect(customTime, &CustomTime::setWidget, this, &MainWindow::setWidget);
connect(customTime, &CustomThread::setProgressBar, this, &MainWindow::setProgressBar);
connect(customTime, &CustomThread::setPlotView, this, &MainWindow::setPlotView);
connect(customTime, &CustomThread::setWidget, this, &MainWindow::setWidget);
}
@ -64,27 +64,19 @@ void MainWindow::on_timeCustomBtn_clicked() {
//校验数据
if (!inspectionData()) { return; }
//传入数据绘图
customTime->setValue(jd, dataName);
// 获取文件大小
int fileSize = 0;
for (int i : jd) {
fileSize += g_param[i].size();
}
//设置进度条
ui->progressBar->setValue(0);
ui->progressBar->setMaximum(fileSize);
ui->progressBar->show();
//运行线程
customTime->setIsTime(true);
customTime->start();
}
void MainWindow::on_dataCustomBtn_clicked() {
//校验数据
if (!inspectionData()) { return; }
//运行线程
customTime->setIsTime(false);
customTime->start();
}
bool MainWindow::inspectionData() {
@ -100,7 +92,7 @@ bool MainWindow::inspectionData() {
return false;
}
//获取基带id
jd.clear();
QVector<int> jd;
if (ui->jd1->isChecked()) {
jd.append(0);
}
@ -127,7 +119,7 @@ bool MainWindow::inspectionData() {
return false;
}
//获取参数名
dataName = ui->comboBox->currentText();
QString dataName = ui->comboBox->currentText();
//判断参数名是否正确
if (!namelist.keys().contains(dataName)) {
QMessageBox::warning(this, "警告", "未找到该数据");
@ -136,6 +128,20 @@ bool MainWindow::inspectionData() {
//创建新窗口
widget = new QWidget();
widget->setWindowTitle(dataName);
//传入数据绘图
customTime->setValue(jd, dataName);
// 获取文件大小
int fileSize = 0;
for (int i: jd) {
fileSize += g_param[i].size();
}
//设置进度条
ui->progressBar->setValue(0);
ui->progressBar->setMaximum(fileSize);
ui->progressBar->show();
return true;
}