diff --git a/CMakeLists.txt b/CMakeLists.txt index a4c5fbb..4c1114c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 ) diff --git a/dataPanel/dpBaseChart.cpp b/dataPanel/dpBaseChart.cpp new file mode 100644 index 0000000..0721b0f --- /dev/null +++ b/dataPanel/dpBaseChart.cpp @@ -0,0 +1,9 @@ +#include "dpBaseChart.h" + +dpBaseChart::dpBaseChart(QWidget* parent) + :dpBaseWidget(parent) +{} + +dpBaseChart::~dpBaseChart() +{ +} diff --git a/dataPanel/dpBaseChart.h b/dataPanel/dpBaseChart.h new file mode 100644 index 0000000..22936b6 --- /dev/null +++ b/dataPanel/dpBaseChart.h @@ -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 diff --git a/dataPanel/dpBaseWidget.h b/dataPanel/dpBaseWidget.h index dad2b24..30e706d 100644 --- a/dataPanel/dpBaseWidget.h +++ b/dataPanel/dpBaseWidget.h @@ -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 diff --git a/dataPanel/dpLineChart.cpp b/dataPanel/dpLineChart.cpp index 594009b..f3beb92 100644 --- a/dataPanel/dpLineChart.cpp +++ b/dataPanel/dpLineChart.cpp @@ -2,7 +2,7 @@ #include "util/Chart/qcustomplot.h" dpLineChart::dpLineChart(QWidget* parent) - :dpBaseWidget(parent) + :dpBaseChart(parent) { setAttribute(Qt::WA_TranslucentBackground,true); diff --git a/dataPanel/dpLineChart.h b/dataPanel/dpLineChart.h index 279ed06..7fa6e81 100644 --- a/dataPanel/dpLineChart.h +++ b/dataPanel/dpLineChart.h @@ -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&);