diff --git a/include/dataPanel.h b/include/dataPanel.h index ae35958..473dc3b 100644 --- a/include/dataPanel.h +++ b/include/dataPanel.h @@ -90,6 +90,8 @@ public slots: void onSignal_configure(); + void onSignal_dataUpdated(const QString& dataKey, const QVariant& data); + signals: void sgl_remove(const QString&); void sgl_openCofigurationDialog(DataPanel*); diff --git a/source/dataPanel.cpp b/source/dataPanel.cpp index 95c4abf..a58b6b4 100644 --- a/source/dataPanel.cpp +++ b/source/dataPanel.cpp @@ -4,7 +4,7 @@ #include "panelConfigurationWidget.h" #include "customBorderContainer.h" #include "customMenu.h" - +#include "dataManager.h" #include "dataPanel/dpLineChart.h" #include @@ -84,6 +84,8 @@ DataPanel::DataPanel(QWidget *parent, DataPanelType type) createDataWidget(type); m_cofigurationResults.setParent(this); + + connect(DataManager::instance(), &DataManager::dataUpdated, this, &DataPanel::onSignal_dataUpdated); } DataPanel::~DataPanel() @@ -93,6 +95,7 @@ DataPanel::~DataPanel() // delete m_pToolMenu; // m_pToolMenu = nullptr; // } + this->disconnect(); //不写也可以,QT本身其实回自动断开所有关联连接 } bool DataPanel::event(QEvent* event) @@ -376,6 +379,9 @@ void DataPanel::setDateTime(const QDateTime& dateTime) dpBaseWidget* baseWidget = qobject_cast(m_pContentWidget); if(baseWidget) baseWidget->setDateTime(dateTime); + + //请求数据 + DataManager::instance()->requestData("dataType", this); } void DataPanel::setTimeRange(TimeUnit unit) @@ -470,3 +476,8 @@ void DataPanel::onSignal_configure() { emit sgl_openCofigurationDialog(this); } + +void DataPanel::onSignal_dataUpdated(const QString& dataKey, const QVariant& data) +{ + +}