From 707c02e8a07530d3d110763fa16ab2a96667cc1e Mon Sep 17 00:00:00 2001 From: pimin <362371171@qq.com> Date: Mon, 27 Oct 2025 09:28:06 +0800 Subject: [PATCH] modified listwgt --- src/ui/Panel/CurvePanel.cpp | 58 +++++++++++++++++++++++++++++++++++++ src/ui/Panel/CurvePanel.h | 4 +++ src/ui/Panel/DataPanel.cpp | 2 +- 3 files changed, 63 insertions(+), 1 deletion(-) diff --git a/src/ui/Panel/CurvePanel.cpp b/src/ui/Panel/CurvePanel.cpp index 8c2f32ac..b969eac1 100644 --- a/src/ui/Panel/CurvePanel.cpp +++ b/src/ui/Panel/CurvePanel.cpp @@ -357,3 +357,61 @@ void CurvePanel::initQChartView() { void CurvePanel::OnDataPanelUpdated(FileEntryCurve* fileEntry) { int a = 0; } + +void CurvePanel::updateTitleAxis(const QString & xTitle, const QString & yTitle) +{ + if (m_pAxisX) + { + if (!xTitle.isEmpty()) + { + m_pAxisX->setTitleText(xTitle); + } + } + if (m_pAxisY) + { + if (!yTitle.isEmpty()) + { + m_pAxisY->setTitleText(yTitle); + } + } +} + +void CurvePanel::updateMinMaxX(float min, float max, int count) +{ + if (max > min) + { + m_iXMin = min; + m_iXMax = max; + + QList axesX; + axesX = curveChart->axes(Qt::Horizontal); + QValueAxis* curAxisX = (QValueAxis*)axesX[0]; + curAxisX->setRange(m_iXMin, m_iXMax); + + if (count > 0) + { + curAxisX->setTickCount(count); + curAxisX->setLabelFormat("%d"); + } + } +} + +void CurvePanel::updateMinMaxY(float min, float max, int count) +{ + if (max > min) + { + m_iYMin = min; + m_iYMax = max; + + QList axesY; + axesY = curveChart->axes(Qt::Vertical); + QValueAxis* curAxisY = (QValueAxis*)axesY[0]; + curAxisY->setRange(m_iYMin, m_iYMax); + + if (count > 0) + { + curAxisY->setTickCount(count); + curAxisY->setLabelFormat("%d"); + } + } +} \ No newline at end of file diff --git a/src/ui/Panel/CurvePanel.h b/src/ui/Panel/CurvePanel.h index 71f32185..3de7f0bc 100644 --- a/src/ui/Panel/CurvePanel.h +++ b/src/ui/Panel/CurvePanel.h @@ -91,6 +91,10 @@ private: */ void UpdateCurveDisplay(); + void updateTitleAxis(const QString& xTitle, const QString& yTitle); + void updateMinMaxX(float min, float max, int count); + void updateMinMaxY(float min, float max, int count); + private: std::shared_ptr chartData_; // Chart data containing curve information bool hasChartData_; // Flag indicating if chart data is available diff --git a/src/ui/Panel/DataPanel.cpp b/src/ui/Panel/DataPanel.cpp index 217a3f08..fa90efeb 100644 --- a/src/ui/Panel/DataPanel.cpp +++ b/src/ui/Panel/DataPanel.cpp @@ -16,7 +16,7 @@ DataPanel::DataPanel(int index, FileEntryType fileType, const QString& filePath, , dockWidget_(nullptr) { title_ = GenerateTitle(); - //InitUI(); + InitUI(); LOG_INFO("Created DataPanel {} for {} file: {}", index_, FileEntryTypeToString(fileType_), filePath_.toStdString()); }