From 06358b4bca9f5c9da4d3022e30ef69e86de51071 Mon Sep 17 00:00:00 2001 From: pimin <362371171@qq.com> Date: Mon, 27 Oct 2025 10:39:03 +0800 Subject: [PATCH] modified listwgt --- src/ui/Panel/CurvePanel.cpp | 18 +++++++++++++----- src/ui/Panel/DataPanel.cpp | 2 +- src/ui/Panel/DataPanel.h | 3 +-- src/ui/Panel/DataPanelManager.cpp | 3 +-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/ui/Panel/CurvePanel.cpp b/src/ui/Panel/CurvePanel.cpp index 2bd17a51..1632e8f9 100644 --- a/src/ui/Panel/CurvePanel.cpp +++ b/src/ui/Panel/CurvePanel.cpp @@ -26,6 +26,11 @@ CurvePanel::CurvePanel(int index, const QString& filePath, QWidget* parent) CurvePanel::CurvePanel(int index, std::shared_ptr fileEntry, QWidget* parent) : DataPanel(index, fileEntry, parent) { + m_iXMin = 0; + m_iXMax = 0; + m_iYMax = 0; + m_iYMin = 0; + if (fileEntry) { LOG_INFO("Created CurvePanel {} for chart: {}", index, fileEntry->GetName().toStdString()); // Override the title with chart name @@ -49,9 +54,9 @@ void CurvePanel::RefreshPanel() OnDataPanelUpdated(fileEntry); } - if (IsValid()) { - UpdateCurveDisplay(); - } + //if (IsValid()) { + // UpdateCurveDisplay(); + //} LOG_INFO("Refreshed CurvePanel {}", GetIndex()); } @@ -291,7 +296,6 @@ void CurvePanel::UpdateCurveDisplay() void CurvePanel::InitUI() { initQChartView(); - } QString CurvePanel::GetTypeDisplayName() const @@ -325,7 +329,11 @@ void CurvePanel::initQChartView() { } void CurvePanel::OnDataPanelUpdated(FileEntryCurve* fileEntry) { - int a = 0; + FileEntryCurve::ChartProperties prop = fileEntry->GetChartProperties(); + + updateTitleAxis(prop.xTitle, prop.yTitle); + updateMinMaxX(prop.xMin, prop.xMax, prop.xCount); + updateMinMaxY(prop.yMin, prop.yMax, prop.yCount); } void CurvePanel::updateTitleAxis(const QString & xTitle, const QString & yTitle) diff --git a/src/ui/Panel/DataPanel.cpp b/src/ui/Panel/DataPanel.cpp index 7401551f..e24245ed 100644 --- a/src/ui/Panel/DataPanel.cpp +++ b/src/ui/Panel/DataPanel.cpp @@ -61,7 +61,7 @@ void DataPanel::InitUI() // layout->addWidget(infoLabel); // setLayout(layout); - RefreshPanel(); + //RefreshPanel(); } QString DataPanel::GenerateTitle() diff --git a/src/ui/Panel/DataPanel.h b/src/ui/Panel/DataPanel.h index 0e6ca4ce..9ce2a2bb 100644 --- a/src/ui/Panel/DataPanel.h +++ b/src/ui/Panel/DataPanel.h @@ -87,6 +87,7 @@ public: virtual void InitUI(); bool IsValid() const { return fileEntry_ != nullptr; } + signals: /** * @brief Panel close signal @@ -100,8 +101,6 @@ protected: */ void closeEvent(QCloseEvent* event) override; - - /** * @brief Generate panel title * @return Generated title diff --git a/src/ui/Panel/DataPanelManager.cpp b/src/ui/Panel/DataPanelManager.cpp index f77759f5..6450dc68 100644 --- a/src/ui/Panel/DataPanelManager.cpp +++ b/src/ui/Panel/DataPanelManager.cpp @@ -193,12 +193,11 @@ DataPanel* DataPanelManager::CreateDataPanel(FileEntryType fileType, const QStri return nullptr; } - //panel->InitUI(); - auto fileEntries = currentWorkspace_->GetFileEntries(fileType); if (index < fileEntries.size()) { panel->SetFileEntry(fileEntries[index]); panel->InitUI(); + panel->RefreshPanel(); } dockWidget->setWidget(panel);