feat(DataPanel):添加和DataManager通信的相关逻辑
This commit is contained in:
parent
25df5b0e54
commit
74de096ec5
|
|
@ -90,6 +90,8 @@ public slots:
|
||||||
|
|
||||||
void onSignal_configure();
|
void onSignal_configure();
|
||||||
|
|
||||||
|
void onSignal_dataUpdated(const QString& dataKey, const QVariant& data);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sgl_remove(const QString&);
|
void sgl_remove(const QString&);
|
||||||
void sgl_openCofigurationDialog(DataPanel*);
|
void sgl_openCofigurationDialog(DataPanel*);
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
#include "panelConfigurationWidget.h"
|
#include "panelConfigurationWidget.h"
|
||||||
#include "customBorderContainer.h"
|
#include "customBorderContainer.h"
|
||||||
#include "customMenu.h"
|
#include "customMenu.h"
|
||||||
|
#include "dataManager.h"
|
||||||
#include "dataPanel/dpLineChart.h"
|
#include "dataPanel/dpLineChart.h"
|
||||||
|
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
|
@ -84,6 +84,8 @@ DataPanel::DataPanel(QWidget *parent, DataPanelType type)
|
||||||
|
|
||||||
createDataWidget(type);
|
createDataWidget(type);
|
||||||
m_cofigurationResults.setParent(this);
|
m_cofigurationResults.setParent(this);
|
||||||
|
|
||||||
|
connect(DataManager::instance(), &DataManager::dataUpdated, this, &DataPanel::onSignal_dataUpdated);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataPanel::~DataPanel()
|
DataPanel::~DataPanel()
|
||||||
|
|
@ -93,6 +95,7 @@ DataPanel::~DataPanel()
|
||||||
// delete m_pToolMenu;
|
// delete m_pToolMenu;
|
||||||
// m_pToolMenu = nullptr;
|
// m_pToolMenu = nullptr;
|
||||||
// }
|
// }
|
||||||
|
this->disconnect(); //不写也可以,QT本身其实回自动断开所有关联连接
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DataPanel::event(QEvent* event)
|
bool DataPanel::event(QEvent* event)
|
||||||
|
|
@ -376,6 +379,9 @@ void DataPanel::setDateTime(const QDateTime& dateTime)
|
||||||
dpBaseWidget* baseWidget = qobject_cast<dpBaseWidget*>(m_pContentWidget);
|
dpBaseWidget* baseWidget = qobject_cast<dpBaseWidget*>(m_pContentWidget);
|
||||||
if(baseWidget)
|
if(baseWidget)
|
||||||
baseWidget->setDateTime(dateTime);
|
baseWidget->setDateTime(dateTime);
|
||||||
|
|
||||||
|
//请求数据
|
||||||
|
DataManager::instance()->requestData("dataType", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataPanel::setTimeRange(TimeUnit unit)
|
void DataPanel::setTimeRange(TimeUnit unit)
|
||||||
|
|
@ -470,3 +476,8 @@ void DataPanel::onSignal_configure()
|
||||||
{
|
{
|
||||||
emit sgl_openCofigurationDialog(this);
|
emit sgl_openCofigurationDialog(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DataPanel::onSignal_dataUpdated(const QString& dataKey, const QVariant& data)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue