diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 3e2ed32..7d29465 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -18,6 +18,8 @@ MainWindow::MainWindow(QWidget *parent) ,_analysisSettingWidget(new AnalysisSettingForm(this)) ,_contextMenu(new QMenu(this)) ,_specificHeatComparisonMethodForm(new SpecificHeatComparisonMethodForm(this)) + ,_instrumentCoefficientForm(new InstrumentCoefficientForm(this)) + ,_degreeOfCureForm(new DegreeOfCureForm(this)) { ui->setupUi(this); this->setToolTip("....."); @@ -36,10 +38,16 @@ MainWindow::MainWindow(QWidget *parent) ui->statusbar->addPermanentWidget(permenentLabel); // // - _expertmentSettingForm->setWindowFlags(_expertmentSettingForm->windowFlags()| Qt::Dialog); - _specificHeatComparisonMethodForm->setWindowFlags(_specificHeatComparisonMethodForm->windowFlags()| Qt::Dialog); + _expertmentSettingForm->setWindowFlags(_expertmentSettingForm->windowFlags()| + Qt::Dialog); + _specificHeatComparisonMethodForm->setWindowFlags( + _specificHeatComparisonMethodForm->windowFlags()| Qt::Dialog); - _realTimeDataForm->setWindowFlags(_realTimeDataForm->windowFlags()| Qt::Dialog); + _realTimeDataForm->setWindowFlags(_realTimeDataForm->windowFlags()| + Qt::Dialog); + + _degreeOfCureForm->setWindowFlags(_degreeOfCureForm->windowFlags()| + Qt::Dialog); // _realTimeDataForm->show(); setActionEnable(true); @@ -223,7 +231,7 @@ void MainWindow::on_actionGlassTransition_triggered() void MainWindow::on_actionOIT_triggered() { - + QMessageBox::warning(this, "warnning", "on_actionOIT_triggered."); } void MainWindow::on_actionSpecificHeatCompMethod_triggered() @@ -233,32 +241,29 @@ void MainWindow::on_actionSpecificHeatCompMethod_triggered() void MainWindow::on_actionDegreeOfCrystallinity_triggered() { - + QMessageBox::warning(this, "warnning", "结晶度."); } void MainWindow::on_actionInstrumentParameter_triggered() { - + _instrumentCoefficientForm->show(); } void MainWindow::on_actionInitialMeltingPoint_triggered() { - } void MainWindow::on_actionFinalMeltingPoint_triggered() { - } void MainWindow::on_actionOITAutoAnalysisParam_triggered() { - } void MainWindow::on_actionOITAutoAnalysisMode_triggered() { - + // } void MainWindow::on_actionTimeAxisAnalysisPCTMode_triggered() @@ -268,5 +273,6 @@ void MainWindow::on_actionTimeAxisAnalysisPCTMode_triggered() void MainWindow::on_actionDegreeOfCuring_triggered() { - + // + _degreeOfCureForm->show(); } diff --git a/src/mainwindow.h b/src/mainwindow.h index cab2357..cf1a7f9 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -13,6 +13,9 @@ #include "rightwidget.h" #include "analysissettingform.h" #include "specificheatcomparisonmethodform.h" +#include "degreeofcrystallinityform.h" +#include "instrumentcoefficientform.h" +#include "degreeofcureform.h" QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } @@ -79,5 +82,8 @@ private: QMenu* _contextMenu; AnalysisSettingForm* _analysisSettingWidget; SpecificHeatComparisonMethodForm* _specificHeatComparisonMethodForm; + DegreeOfCrystallinityForm * _degreeOfCrystallinityForm; + InstrumentCoefficientForm* _instrumentCoefficientForm; + DegreeOfCureForm *_degreeOfCureForm; }; #endif // MAINWINDOW_H diff --git a/src/ui/centralwidget.cpp b/src/ui/centralwidget.cpp index 4e966b9..9eeeff7 100644 --- a/src/ui/centralwidget.cpp +++ b/src/ui/centralwidget.cpp @@ -45,15 +45,12 @@ CentralWidget::CentralWidget(QWidget *parent) _eventHandler->setEnable(true); _customPlot->installEventFilter(_eventHandler); - _customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables); +// _customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables); + _customPlot->setInteractions( QCP::iRangeZoom | QCP::iSelectPlottables); connect(_eventHandler,&EventHandler::sigSendLineXCoord, this,&CentralWidget::sigSendLineXCoord); - // connect(_customPlot, &QCustomPlot::selectionChangedByUser, - // this, &CentralWidget::slotSelectionChanged); - - setEventHandlerEnable(false); // #if 0 @@ -143,9 +140,8 @@ void CentralWidget::slotRecvAnalysisFileName(const QString &fileName) { qDebug() << "slotRecvAnalysisFileName" << fileName; - // - // clearData(ClearDataMode::All); - // + // todo.禁止重复文件添加。 + _dataVtr.clear(); FileManager::readExperimentFile(fileName, _dataVtr); @@ -208,6 +204,7 @@ void CentralWidget::slotRecvAnalysisFileName(const QString &fileName) _customPlot->replot(); } +// discard void CentralWidget::slotSelectionChanged() { logde<<"selectedPlottables:"<< _customPlot->selectedPlottables().size(); @@ -598,12 +595,16 @@ void CentralWidget::clearData(const CentralWidget::ClearDataMode mode) { if(mode == ClearDataMode::All){ // Clear the data of graph. -#if 0 - if (_customPlot->graphCount() > 0 && _currentGraph) - { - _currentGraph->setData(QVector(), QVector()); + + for (int i = _customPlot->plottableCount() - 1; i >= 0; --i) { + QCPAbstractPlottable* plottable = _customPlot->plottable(i); + if (auto curve = dynamic_cast(plottable)) { + _customPlot->removePlottable(curve); + } } -#endif + + // Clear data. + Global::instance()->_curveDataVtr.clear(); // Set lines visiable false. _line1->setVisible(false); @@ -624,6 +625,7 @@ void CentralWidget::clearData(const CentralWidget::ClearDataMode mode) } } #endif + // Delete items. QList itemsToKeep; itemsToKeep << _line1 << _line2; diff --git a/src/ui/degreeofcrystallinityform.cpp b/src/ui/degreeofcrystallinityform.cpp index ec8a962..efc8b8b 100644 --- a/src/ui/degreeofcrystallinityform.cpp +++ b/src/ui/degreeofcrystallinityform.cpp @@ -12,3 +12,13 @@ DegreeOfCrystallinityForm::~DegreeOfCrystallinityForm() { delete ui; } + +void DegreeOfCrystallinityForm::on_pushButtonCalculate_clicked() +{ + +} + +void DegreeOfCrystallinityForm::on_pushButtonQuit_clicked() +{ + +} diff --git a/src/ui/degreeofcrystallinityform.h b/src/ui/degreeofcrystallinityform.h index 9fc0d08..d61576d 100644 --- a/src/ui/degreeofcrystallinityform.h +++ b/src/ui/degreeofcrystallinityform.h @@ -15,6 +15,11 @@ public: explicit DegreeOfCrystallinityForm(QWidget *parent = nullptr); ~DegreeOfCrystallinityForm(); +private slots: + void on_pushButtonCalculate_clicked(); + + void on_pushButtonQuit_clicked(); + private: Ui::DegreeOfCrystallinityForm *ui; }; diff --git a/src/ui/eventhandler.cpp b/src/ui/eventhandler.cpp index d632507..84dd951 100644 --- a/src/ui/eventhandler.cpp +++ b/src/ui/eventhandler.cpp @@ -76,7 +76,7 @@ bool EventHandler::eventFilter(QObject *obj, QEvent *event) _draggingLine->point1->setCoords(x, _plot->yAxis->range().lower); _draggingLine->point2->setCoords(x, _plot->yAxis->range().upper); _plot->replot(); - updateSelectedRegion(); +// updateSelectedRegion(); } } else if (event->type() == QEvent::MouseButtonPress) @@ -226,6 +226,7 @@ void EventHandler::slotSample() void EventHandler::updateSelectedRegion() { +#if 0 double x1 = _line1->point1->coords().x(); double x2 = _line1->point1->coords().x(); if (x1 > x2) @@ -246,6 +247,7 @@ void EventHandler::updateSelectedRegion() int index2 = findClosestIndex(xData, x2); // qDebug() << "Selected region: [" << xData[index1] << ", " << xData[index2] << "]"; +#endif } int EventHandler::findClosestIndex(const QVector &data, double target) diff --git a/src/ui/eventhandler.h b/src/ui/eventhandler.h index 2997e20..7905cc1 100644 --- a/src/ui/eventhandler.h +++ b/src/ui/eventhandler.h @@ -23,7 +23,7 @@ public: #endif ~EventHandler(); - void setGraph(QCPGraph* g){ _graph = g;} +// void setGraph(QCPGraph* g){ _graph = g;} void setEnable(const bool flag){_enableFlag = flag;} enum Mode{ Null, @@ -52,7 +52,7 @@ private: QCustomPlot *_plot; QCPItemStraightLine *_line1,*_line2; QCPItemStraightLine *_draggingLine = nullptr; - QCPGraph *_graph; +// QCPGraph *_graph; QMenu* _menu; QAction* _specificHeatItemAction,*_baseLineAction, *_standardSampleAction,*_sampleAction; diff --git a/src/ui/specificheatcomparisonmethodform.cpp b/src/ui/specificheatcomparisonmethodform.cpp index f7e65b5..b7360f2 100644 --- a/src/ui/specificheatcomparisonmethodform.cpp +++ b/src/ui/specificheatcomparisonmethodform.cpp @@ -126,7 +126,14 @@ void SpecificHeatComparisonMethodForm::on_pushButtonCalculate_clicked() float standardSampleWeight = ui->LineEditStandardSampleWeight->text().toFloat(); float sampleWeight = ui->LineEditSampleWeight->text().toFloat(); -// double cpTarget = cp * + float k = ui->LineEditCorrectionCoefficient->text().toFloat(); + + // 蓝宝石比热容 * 标样质量 * (样品流值 - 基线流值)* 系数 /(样品质量 * (标样流值 - 基线流值)) + double cpTarget = cp * standardSampleWeight * ( samplePoint.y() - baseLinePoint.y()) * k / + (sampleWeight *(standardSamplePoint.y() - baseLinePoint.y())); + + ui->LineEditStandardSampleSpecificHeat->setText(QString::number(cp,'f',3)); + ui->LineEditSampleSpecificHeat->setText(QString::number(cpTarget,'f',3)); } void SpecificHeatComparisonMethodForm::on_pushButtonQuit_clicked()