diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5f77cf7..c89293a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -453,7 +453,7 @@ void MainWindow::startExperimentByDeviceInfo() { // 实验开始,清除上一个实验所有数据。 Global::clearExperimentData(); } - +// 停止实验 void MainWindow::on_actionStop_triggered() { logde << " Stop experiment ...++++++++++++++++++"; @@ -544,6 +544,11 @@ void MainWindow::slotSaveExperimentalDataMsgBox() { QMessageBox::information(this, "文件保存", str, QMessageBox::Yes); } + // 清除数据action恢复功能 + ui->actionClearAllData->setEnabled(true); + // 分析menu恢复功能 + ui->menu_4->menuAction()->setEnabled(true); + #if 0 QMessageBox::StandardButton reply; reply = QMessageBox::question(this, "数据保存提示", "是否保存实验数据?", @@ -691,17 +696,17 @@ void MainWindow::on_actionEnthalpyCorrectionSelection_triggered() { void MainWindow::on_actionPrintPreview_triggered() { logde << "print preview..."; - if(Global::_curveFileDataVtr.empty()){ + if (Global::_curveFileDataVtr.empty()) { showMesgBox("请先打开数据。"); return; } _printPreviewForm->setPixmap(_centralWidget->getPixMap()); // _printPreviewForm->_customPrintPreviewDialog->showMaximized(); -// _printPreviewForm->setOrientation(); - + // _printPreviewForm->setOrientation(); + _printPreviewForm->_customPrintPreviewDialog->exec(); - _printPreviewForm->_customPrintPreviewDialog->update(); // 可选,强制刷新 + _printPreviewForm->_customPrintPreviewDialog->update(); // 可选,强制刷新 } void MainWindow::on_actionOnsetTemperaturePoint_triggered() { @@ -776,6 +781,7 @@ void MainWindow::on_actionSmoothness10_triggered() { smoothness(10); } +// 原始数据 void MainWindow::on_actionOriginalData_triggered() { if (!Global::_curveExperimentDataVtr.empty()) { // 删除所有objectName为experiment的curve. @@ -787,6 +793,10 @@ void MainWindow::on_actionOriginalData_triggered() { } } else { // 当前数据为文件分析数据时,需要把当前文件下的所有数据都进行平滑处理。 + if(_centralWidget->getCurrentCurve() == nullptr){ + return; + } + QString selectedCurveObjectName = _centralWidget->getCurrentCurve()->objectName(); _centralWidget->deleteCurveByObjectName(selectedCurveObjectName); @@ -801,7 +811,6 @@ void MainWindow::on_actionOriginalData_triggered() { } } - #if 0 // process data. QVector targetDataVtr; diff --git a/src/mainwindow.h b/src/mainwindow.h index 711e74a..57ec3ad 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -52,6 +52,7 @@ private slots: void on_actionConnectToDev_triggered(); void on_actionNew_triggered(); void on_actionStart_triggered(); + // 停止实验 void on_actionStop_triggered(); void on_actionReadOnly_triggered(); void on_actionRealTimeWidget_triggered(); @@ -115,7 +116,7 @@ private slots: void on_actionSmoothness8_triggered(); void on_actionSmoothness9_triggered(); void on_actionSmoothness10_triggered(); - +// 原始数据 void on_actionOriginalData_triggered(); private: diff --git a/src/ui/centralwidget.cpp b/src/ui/centralwidget.cpp index ca2d3bb..5293c61 100644 --- a/src/ui/centralwidget.cpp +++ b/src/ui/centralwidget.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "oitautoanalysis.h" #include "analysisoperationrecorder.h" @@ -351,7 +352,7 @@ void CentralWidget::slotRecvCommonData(const CommonData &cd) { } void CentralWidget::slotRecvAnalysisFileName(const QString &filePath) { - logde<<"slotRecvAnalysisFileName, filePath:" << filePath.toStdString(); + logde << "slotRecvAnalysisFileName, filePath:" << filePath.toStdString(); if (_analysisFilePathVtr.contains(filePath)) { return; @@ -370,11 +371,11 @@ void CentralWidget::slotRecvAnalysisFileName(const QString &filePath) { for (int i = Global::_curveFileDataVtr.size() - 1; i >= 0; --i) { if (Global::_curveFileDataVtr[i].filePath == filePath) { // 已经存在该文件数据,直接返回 - logde<<"file exist...return."; + logde << "file exist...return."; return; } } - + Global::_curveFileDataVtr.push_back(cfd); // @@ -611,6 +612,15 @@ void CentralWidget::slotSelectionChangedByUser() { _currentCurve = curve; // 更新当前选中的曲线 } } + // 输出xy轴最值 + auto *ax = _customPlot->xAxis; + auto *ay = _customPlot->yAxis; + double xMin = ax->range().lower; + double xMax = ax->range().upper; + double yMin = ay->range().lower; + double yMax = ay->range().upper; + + logde << "min/max:" << xMin << "," << xMax << "," << yMin << "," << yMax; } void CentralWidget::uiLoadXlsxFileData() { @@ -1080,6 +1090,7 @@ void CentralWidget::setEventHandlerEnable(const bool flag) { } QPointF CentralWidget::getTheCoordinatesOfTheTextBox(const QPointF point) { +#if 0 double xMax = _customPlot->xAxis->range().upper; double xMin = _customPlot->xAxis->range().lower; @@ -1092,6 +1103,22 @@ QPointF CentralWidget::getTheCoordinatesOfTheTextBox(const QPointF point) { double distance = (xMax - xMin) / ticks.size(); return QPointF(point.x() + distance, point.y()); +#endif + // 输出xy轴最值 + auto *ax = _customPlot->xAxis; + auto *ay = _customPlot->yAxis; + double xMin = ax->range().lower; + double xMax = ax->range().upper; + double yMin = ay->range().lower; + double yMax = ay->range().upper; + + logde << "min/max:" << xMin << "," << xMax << "," << yMin << "," << yMax; + + double xDistance = (xMax - xMin); + double yDistance = (yMax - yMin); + + return QPointF(xMin + xDistance / 5 * 4, + yMin + yDistance / 5); } void CentralWidget::drawText(const QPointF point, const QString text, const QString objectName) {