2025-04-29T17:29:14
This commit is contained in:
parent
c3aa0df987
commit
51732f394c
Binary file not shown.
@ -28,6 +28,7 @@ SOURCES += \
|
||||
global.cpp \
|
||||
logger/logger.cpp \
|
||||
ui/aboutform.cpp \
|
||||
ui/axissettingform.cpp \
|
||||
ui/coefficientselectionform.cpp \
|
||||
ui/enthalpydatacorrectionform.cpp \
|
||||
ui/localcustomplot.cpp \
|
||||
@ -61,6 +62,7 @@ HEADERS += \
|
||||
defines.h \
|
||||
logger/logger.h \
|
||||
ui/aboutform.h \
|
||||
ui/axissettingform.h \
|
||||
ui/coefficientselectionform.h \
|
||||
ui/enthalpydatacorrectionform.h \
|
||||
ui/localcustomplot.h \
|
||||
@ -88,6 +90,7 @@ HEADERS += \
|
||||
FORMS += \
|
||||
mainwindow.ui \
|
||||
ui/aboutform.ui \
|
||||
ui/axissettingform.ui \
|
||||
ui/coefficientselectionform.ui \
|
||||
ui/degreeofcrystallinityform.ui \
|
||||
ui/degreeofcureform.ui \
|
||||
|
@ -12,6 +12,13 @@ CurveExperimentData* _currentCurveExperimentDataPtr = nullptr;
|
||||
|
||||
bool _enthalpyCoefficientEnableFlag = false;
|
||||
QVector<double> _enthalpyCoefficientVtr;
|
||||
|
||||
QString converDoubleToStr(const double num)
|
||||
{
|
||||
return QString::number(num,'f',3);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -90,6 +90,8 @@ extern bool _enthalpyCoefficientEnableFlag;
|
||||
///abc
|
||||
extern QVector<double> _enthalpyCoefficientVtr;
|
||||
|
||||
// common func
|
||||
QString converDoubleToStr(const double);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -28,6 +28,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
,_enthalpyDataCorrectionForm(new EnthalpyDataCorrectionForm(this))
|
||||
,_coefficientSelectionForm(new CoefficientSelectionForm(this))
|
||||
,_printPreviewForm(new PrintPreviewForm(this))
|
||||
,_axisSettingForm(new AxisSettingForm(this))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setToolTip(".....");
|
||||
@ -56,6 +57,8 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
setSubWidgetAttribute(_enthalpyDataCorrectionForm);
|
||||
setSubWidgetAttribute(_coefficientSelectionForm);
|
||||
setSubWidgetAttribute(_printPreviewForm);
|
||||
setSubWidgetAttribute(_axisSettingForm);
|
||||
|
||||
//
|
||||
setActionEnable(true);
|
||||
|
||||
@ -69,8 +72,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
// 删除非QObject派生类的对象
|
||||
// 假设 Ui::MainWindow 不是 QObject 派生类
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@ -155,6 +156,13 @@ void MainWindow::connections()
|
||||
_specificHeatComparisonMethodForm,
|
||||
&SpecificHeatComparisonMethodForm::slotSetCurve);
|
||||
|
||||
// Axis settings.
|
||||
connect(_axisSettingForm,&AxisSettingForm::sigGetAxisInfo,
|
||||
_centralWidget,&CentralWidget::slotGetAxisInfo);
|
||||
connect(_centralWidget,&CentralWidget::sigGetAxisInfoWithData,
|
||||
_axisSettingForm,&AxisSettingForm::slotGetAxisInfoWithData);
|
||||
connect(_axisSettingForm,&AxisSettingForm::sigSetAxisSettings,
|
||||
_centralWidget,&CentralWidget::slotSetAxisSettings);
|
||||
}
|
||||
|
||||
void MainWindow::setActionEnable(const bool flag)
|
||||
@ -394,3 +402,8 @@ void MainWindow::on_actionYAxis_triggered()
|
||||
{
|
||||
_centralWidget->switchAxisMode();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionAxisSetting_triggered()
|
||||
{
|
||||
_axisSettingForm->show();
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <QStatusBar>
|
||||
#include <QDockWidget>
|
||||
|
||||
#include "axissettingform.h"
|
||||
#include "printpreviewform.h"
|
||||
#include "centralwidget.h"
|
||||
#include "leftwidget.h"
|
||||
@ -89,6 +90,8 @@ private slots:
|
||||
|
||||
void on_actionYAxis_triggered();
|
||||
|
||||
void on_actionAxisSetting_triggered();
|
||||
|
||||
private:
|
||||
void connections();
|
||||
void setActionEnable(const bool);
|
||||
@ -113,5 +116,6 @@ private:
|
||||
EnthalpyDataCorrectionForm* _enthalpyDataCorrectionForm;
|
||||
CoefficientSelectionForm * _coefficientSelectionForm;
|
||||
PrintPreviewForm *_printPreviewForm;
|
||||
AxisSettingForm * _axisSettingForm;
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
|
@ -84,9 +84,16 @@
|
||||
</property>
|
||||
<addaction name="actionAbout"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_8">
|
||||
<property name="title">
|
||||
<string>设置</string>
|
||||
</property>
|
||||
<addaction name="actionAxisSetting"/>
|
||||
</widget>
|
||||
<addaction name="menu"/>
|
||||
<addaction name="menu_2"/>
|
||||
<addaction name="menu_3"/>
|
||||
<addaction name="menu_8"/>
|
||||
<addaction name="menu_4"/>
|
||||
<addaction name="menu_5"/>
|
||||
<addaction name="menu_6"/>
|
||||
@ -297,6 +304,11 @@
|
||||
<string>Y轴</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAxisSetting">
|
||||
<property name="text">
|
||||
<string>坐标轴设置</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="images.qrc"/>
|
||||
|
75
src/ui/axissettingform.cpp
Normal file
75
src/ui/axissettingform.cpp
Normal file
@ -0,0 +1,75 @@
|
||||
#include "axissettingform.h"
|
||||
#include "ui_axissettingform.h"
|
||||
#include "global.h"
|
||||
|
||||
AxisSettingForm::AxisSettingForm(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::AxisSettingForm)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
||||
}
|
||||
|
||||
AxisSettingForm::~AxisSettingForm()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void AxisSettingForm::slotGetAxisInfoWithData(const QVector<CentralWidget::AxisInfo> vtr)
|
||||
{
|
||||
ui->lineEditXMin->setText(Global::converDoubleToStr(vtr.first().lower));
|
||||
ui->lineEditXMax->setText(Global::converDoubleToStr(vtr.first().upper));
|
||||
|
||||
ui->lineEditYLeftMin->setText(Global::converDoubleToStr(vtr.at(1).lower));
|
||||
ui->lineEditYLeftMax->setText(Global::converDoubleToStr(vtr.at(1).upper));
|
||||
|
||||
//Axis Y right.
|
||||
ui->lineEditYRightMin->setEnabled(vtr.last().visiable);
|
||||
ui->lineEditYRightMax->setEnabled(vtr.last().visiable);
|
||||
|
||||
if(vtr.last().visiable){
|
||||
ui->lineEditYRightMin->setText(Global::converDoubleToStr(vtr.last().lower));
|
||||
ui->lineEditYRightMax->setText(Global::converDoubleToStr(vtr.last().upper));
|
||||
}else{
|
||||
ui->lineEditYRightMin->setText(0);
|
||||
ui->lineEditYRightMax->setText(0);
|
||||
}
|
||||
}
|
||||
|
||||
void AxisSettingForm::showEvent(QShowEvent *event)
|
||||
{
|
||||
emit sigGetAxisInfo();
|
||||
QWidget::showEvent(event);
|
||||
}
|
||||
|
||||
void AxisSettingForm::on_pushButtonConfirm_clicked()
|
||||
{
|
||||
QVector<double> vtr;
|
||||
|
||||
#if 0
|
||||
double xMin = ui->lineEditXMin->text().toDouble();
|
||||
double xMax = ui->lineEditXMin->text().toDouble();
|
||||
double yLeftMin = ui->lineEditYLeftMin->text().toDouble();
|
||||
double yLeftMax = ui->lineEditYLeftMax->text().toDouble();
|
||||
|
||||
double yRightMin = ui->lineEditYRightMin->text().toDouble();
|
||||
double yRightMax = ui->lineEditYRightMax->text().toDouble();
|
||||
#endif
|
||||
|
||||
vtr.push_back(ui->lineEditXMin->text().toDouble());
|
||||
vtr.push_back(ui->lineEditXMax->text().toDouble());
|
||||
|
||||
vtr.push_back(ui->lineEditYLeftMin->text().toDouble());
|
||||
vtr.push_back(ui->lineEditYLeftMax->text().toDouble());
|
||||
|
||||
vtr.push_back(ui->lineEditYRightMin->text().toDouble());
|
||||
vtr.push_back(ui->lineEditYRightMax->text().toDouble());
|
||||
|
||||
emit sigSetAxisSettings(vtr);
|
||||
}
|
||||
|
||||
void AxisSettingForm::on_pushButtonCancel_clicked()
|
||||
{
|
||||
hide();
|
||||
}
|
35
src/ui/axissettingform.h
Normal file
35
src/ui/axissettingform.h
Normal file
@ -0,0 +1,35 @@
|
||||
#ifndef AXISSETTINGFORM_H
|
||||
#define AXISSETTINGFORM_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "centralwidget.h"
|
||||
|
||||
namespace Ui {
|
||||
class AxisSettingForm;
|
||||
}
|
||||
|
||||
class AxisSettingForm : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AxisSettingForm(QWidget *parent = nullptr);
|
||||
~AxisSettingForm();
|
||||
|
||||
signals:
|
||||
void sigSetAxisSettings(const QVector<double>);
|
||||
void sigGetAxisInfo();
|
||||
public slots:
|
||||
void slotGetAxisInfoWithData(const QVector<CentralWidget::AxisInfo>);
|
||||
protected:
|
||||
void showEvent(QShowEvent *event) override;
|
||||
private slots:
|
||||
void on_pushButtonConfirm_clicked();
|
||||
|
||||
void on_pushButtonCancel_clicked();
|
||||
|
||||
private:
|
||||
Ui::AxisSettingForm *ui;
|
||||
};
|
||||
|
||||
#endif // AXISSETTINGFORM_H
|
123
src/ui/axissettingform.ui
Normal file
123
src/ui/axissettingform.ui
Normal file
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AxisSettingForm</class>
|
||||
<widget class="QWidget" name="AxisSettingForm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>387</width>
|
||||
<height>163</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="gridLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>10</y>
|
||||
<width>351</width>
|
||||
<height>111</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEditYLeftMin"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEditYRightMin"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEditXMin"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLineEdit" name="lineEditXMax"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>坐标轴</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>最大值</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLineEdit" name="lineEditYRightMax"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>最小值</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLineEdit" name="lineEditYLeftMax"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>X</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Y 左侧</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Y 右侧</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButtonConfirm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<y>130</y>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>应用</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButtonCancel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>270</x>
|
||||
<y>130</y>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>关闭</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -126,20 +126,25 @@ void CentralWidget::switchAxisMode()
|
||||
|
||||
QCPCurve* curve = new QCPCurve(_customPlot->xAxis, _customPlot->yAxis2);
|
||||
curve->setData(tVtr, xVtr, yVtr);
|
||||
|
||||
curve->setPen(QPen(QColor(Qt::red)));
|
||||
curve->setObjectName(Global::CurveOfTimeTypeObjectName);
|
||||
|
||||
// logde<<"plottableCount count:"<<_customPlot->plottableCount();
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
_axisMode = AxisMode::SingleY;
|
||||
|
||||
_customPlot->yAxis2->setVisible(false);
|
||||
|
||||
for (int i = _customPlot->graphCount() - 1; i >= 0; --i) {
|
||||
QCPGraph *graph = _customPlot->graph(i);
|
||||
if(graph && graph->objectName() == Global::CurveOfTimeTypeObjectName){
|
||||
_customPlot->removeGraph(graph);
|
||||
// logde<<"graph count:"<<_customPlot->plottableCount();
|
||||
|
||||
for (int i = _customPlot->plottableCount() - 1; i >= 0; --i) {
|
||||
QCPAbstractPlottable* plottable = _customPlot->plottable(i);
|
||||
if (auto curve = dynamic_cast<QCPCurve*>(plottable)) {
|
||||
if(curve && curve->objectName() == Global::CurveOfTimeTypeObjectName){
|
||||
_customPlot->removePlottable(curve);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -235,9 +240,11 @@ void CentralWidget::slotRecvCommonData(const CommonData &cd)
|
||||
|
||||
void CentralWidget::slotRecvAnalysisFileName(const QString &filePath)
|
||||
{
|
||||
qDebug() << "slotRecvAnalysisFileName" << filePath;
|
||||
if(_analysisFilePathVtr.contains(filePath)){
|
||||
return;
|
||||
}
|
||||
|
||||
// todo.禁止重复文件添加。
|
||||
qDebug() << "slotRecvAnalysisFileName" << filePath;
|
||||
|
||||
Global::CurveFileData cfd;
|
||||
if(XlsxHandler::readFile(filePath,cfd) != 0){
|
||||
@ -439,6 +446,38 @@ void CentralWidget::slotDrawCustomText(const QString str)
|
||||
_customPlot->replot();
|
||||
}
|
||||
|
||||
void CentralWidget::slotGetAxisInfo()
|
||||
{
|
||||
QVector<AxisInfo> vtr;
|
||||
|
||||
auto func = [&](QCPAxis* axis){
|
||||
AxisInfo ai;
|
||||
ai.visiable = axis->visible();
|
||||
ai.lower = axis->range().lower;
|
||||
ai.upper = axis->range().upper;
|
||||
|
||||
vtr.push_back(ai);
|
||||
};
|
||||
|
||||
func(_customPlot->xAxis);
|
||||
func(_customPlot->yAxis);
|
||||
func(_customPlot->yAxis2);
|
||||
|
||||
emit sigGetAxisInfoWithData(vtr);
|
||||
}
|
||||
|
||||
void CentralWidget::slotSetAxisSettings(const QVector<double>vtr)
|
||||
{
|
||||
_customPlot->xAxis->setRange(vtr.at(0),vtr.at(1));
|
||||
_customPlot->yAxis->setRange(vtr.at(2),vtr.at(3));
|
||||
|
||||
if(_customPlot->yAxis2->visible()){
|
||||
_customPlot->yAxis2->setRange(vtr.at(4),vtr.at(5));
|
||||
}
|
||||
|
||||
_customPlot->replot();
|
||||
}
|
||||
|
||||
void CentralWidget::timerEvent(QTimerEvent *event)
|
||||
{
|
||||
_customPlot->replot();
|
||||
@ -952,7 +991,7 @@ void CentralWidget::clearData(const CentralWidget::ClearDataMode mode)
|
||||
_line2->setVisible(false);
|
||||
}
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
// Clear graph on plot.
|
||||
for (int i = _customPlot->graphCount() - 1; i >= 0; --i) {
|
||||
QCPGraph *graph = _customPlot->graph(i);
|
||||
|
@ -41,10 +41,17 @@ public:
|
||||
DoubleY
|
||||
};
|
||||
void switchAxisMode();
|
||||
struct AxisInfo{
|
||||
bool visiable;
|
||||
double lower;
|
||||
double upper;
|
||||
};
|
||||
signals:
|
||||
void sigContextMenuShow(const QPoint);
|
||||
void sigSendLineXCoord(const int,const double);
|
||||
void sigRightDockWidgetHide();
|
||||
|
||||
void sigGetAxisInfoWithData(const QVector<AxisInfo>);
|
||||
public slots:
|
||||
// experiment
|
||||
void slotAxisModify(const float temp);
|
||||
@ -61,6 +68,9 @@ public slots:
|
||||
void slotAnalysisSettingLineXPoint(const int index,const double);
|
||||
|
||||
void slotDrawCustomText(const QString);
|
||||
//
|
||||
void slotGetAxisInfo();
|
||||
void slotSetAxisSettings(const QVector<double>);
|
||||
protected:
|
||||
void timerEvent(QTimerEvent* event);
|
||||
void contextMenuEvent(QContextMenuEvent *event);
|
||||
@ -95,6 +105,7 @@ private:
|
||||
// QVector<Global::ExperimentData> _dataVtr;
|
||||
QVector<QCPItemStraightLine*> _lineVtr;
|
||||
AxisMode _axisMode;
|
||||
QVector<QString> _analysisFilePathVtr;
|
||||
};
|
||||
|
||||
#endif // CENTRALWIDGET_H
|
||||
|
Loading…
Reference in New Issue
Block a user