refactor:更新dataPanel代码结构,增加dpBaseChart类
This commit is contained in:
parent
4c6d184f0f
commit
62c1d349fb
|
|
@ -116,6 +116,8 @@ set(DATAPANEL_FILES
|
|||
dataPanel/dpConfigurationDialog.cpp
|
||||
dataPanel/dpBaseWidget.h
|
||||
dataPanel/dpBaseWidget.cpp
|
||||
dataPanel/dpBaseChart.h
|
||||
dataPanel/dpBaseChart.cpp
|
||||
dataPanel/dpLineChart.h
|
||||
dataPanel/dpLineChart.cpp
|
||||
)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
#include "dpBaseChart.h"
|
||||
|
||||
dpBaseChart::dpBaseChart(QWidget* parent)
|
||||
:dpBaseWidget(parent)
|
||||
{}
|
||||
|
||||
dpBaseChart::~dpBaseChart()
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef DPBASECHART_H
|
||||
#define DPBASECHART_H
|
||||
|
||||
#include "dpBaseWidget.h"
|
||||
|
||||
class dpBaseChart : public dpBaseWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
dpBaseChart(QWidget *parent = nullptr);
|
||||
~dpBaseChart();
|
||||
|
||||
void setTimeRange(TimeUnit) {}
|
||||
void setDateTime(const QDateTime&) {}
|
||||
void viewHistoricalData(const QDateTime&) {}
|
||||
|
||||
protected:
|
||||
struct ChartStyle
|
||||
{
|
||||
QColor bgColor; //背景颜色
|
||||
QColor axisColor; //坐标轴颜色
|
||||
QColor tickColor; //刻度颜色
|
||||
QColor tickLabelColor; //刻度label颜色
|
||||
QFont tickLabelFont; //刻度label字体
|
||||
QPen gridPen; //网格线颜色
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -26,19 +26,6 @@ public:
|
|||
virtual void setTimeRange(TimeUnit) {}
|
||||
virtual void setDateTime(const QDateTime&) {}
|
||||
virtual void viewHistoricalData(const QDateTime&) {}
|
||||
|
||||
protected:
|
||||
struct ChartStyle
|
||||
{
|
||||
QColor bgColor; //背景颜色
|
||||
QColor axisColor; //坐标轴颜色
|
||||
QColor tickColor; //刻度颜色
|
||||
QColor tickLabelColor; //刻度label颜色
|
||||
QFont tickLabelFont; //刻度label字体
|
||||
QPen gridPen; //网格线颜色
|
||||
};
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "util/Chart/qcustomplot.h"
|
||||
|
||||
dpLineChart::dpLineChart(QWidget* parent)
|
||||
:dpBaseWidget(parent)
|
||||
:dpBaseChart(parent)
|
||||
{
|
||||
setAttribute(Qt::WA_TranslucentBackground,true);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@
|
|||
**
|
||||
******************************************************************************/
|
||||
|
||||
#include "dpBaseWidget.h"
|
||||
#include "dpBaseChart.h"
|
||||
|
||||
class QCustomPlot;
|
||||
class QCPRange;
|
||||
|
||||
class dpLineChart : public dpBaseWidget
|
||||
class dpLineChart : public dpBaseChart
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
|
@ -23,9 +23,9 @@ public:
|
|||
dpLineChart(QWidget *parent = nullptr);
|
||||
~dpLineChart();
|
||||
|
||||
void setTimeRange(TimeUnit);
|
||||
void setDateTime(const QDateTime&);
|
||||
void viewHistoricalData(const QDateTime&);
|
||||
void setTimeRange(TimeUnit) override;
|
||||
void setDateTime(const QDateTime&) override;
|
||||
void viewHistoricalData(const QDateTime&) override;
|
||||
|
||||
public slots:
|
||||
void onSignal_rangeChanged_xAxis(const QCPRange&);
|
||||
|
|
|
|||
Loading…
Reference in New Issue