##// END OF EJS Templates
Adds templete to chartviewer to simplyfy chart type creation
Michal Klocek -
r1839:16961447933b
parent child
Show More
@@ -35,11 +35,7 QTCOMMERCIALCHART_USE_NAMESPACE
35 35 class Chart
36 36 {
37 37 public:
38 Chart();
39
40 virtual ~Chart();
41
42 virtual void initialize();
38 virtual ~Chart(){};
43 39 virtual QChart* createChart(const DataTable& table) = 0;
44 40 virtual QString name() = 0;
45 41 virtual QString category() = 0;
@@ -81,6 +77,17 inline void addChart(Chart* chart)
81 77 }
82 78 }
83 79
84 #define DECLARE_CHART(chartName) static chartName t;
80 template <class T>
81 class ChartWrapper
82 {
83 public:
84 QSharedPointer<T> chart;
85 ChartWrapper() : chart(new T)
86 {
87 Charts::addChart(chart.data());
88 }
89 };
90
91 #define DECLARE_CHART(chartName) static ChartWrapper<chartName> t;
85 92
86 93 #endif
@@ -26,11 +26,6
26 26 class AreaChart: public Chart
27 27 {
28 28 public:
29
30 AreaChart(){
31 initialize();
32 }
33
34 29 QString name() { return QObject::tr("AreaChart"); }
35 30 QString category() { return QObject::tr("XYSeries"); }
36 31 QString subCategory() { return QString::null; }
@@ -26,11 +26,6
26 26 class HorizontalBarChart: public Chart
27 27 {
28 28 public:
29
30 HorizontalBarChart(){
31 initialize();
32 }
33
34 29 QString name() { return QObject::tr("HorizontalBarChart"); }
35 30 QString category() { return QObject::tr("BarSeries"); }
36 31 QString subCategory() { return QObject::tr("Vertical"); }
@@ -26,11 +26,6
26 26 class HorizontalStackedBarChart: public Chart
27 27 {
28 28 public:
29
30 HorizontalStackedBarChart(){
31 initialize();
32 }
33
34 29 QString name() { return QObject::tr("HorizontalStackedBarChart"); }
35 30 QString category() { return QObject::tr("BarSeries"); }
36 31 QString subCategory() { return QObject::tr("Vertical"); }
@@ -25,11 +25,6
25 25 class LineChart: public Chart
26 26 {
27 27 public:
28
29 LineChart(){
30 initialize();
31 }
32
33 28 QString name() { return QObject::tr("LineChart"); }
34 29 QString category() { return QObject::tr("XYSeries"); }
35 30 QString subCategory() { return QString::null; }
@@ -25,11 +25,6
25 25 class PieChart: public Chart
26 26 {
27 27 public:
28
29 PieChart(){
30 initialize();
31 }
32
33 28 QString name() { return QObject::tr("PieChart"); }
34 29 QString category() { return QString::null; }
35 30 QString subCategory() { return QString::null; }
@@ -25,11 +25,6
25 25 class ScatterChart: public Chart
26 26 {
27 27 public:
28
29 ScatterChart(){
30 initialize();
31 }
32
33 28 QString name() { return QObject::tr("ScatterChart"); }
34 29 QString category() { return QObject::tr("XYSeries"); }
35 30 QString subCategory() { return QString::null; }
@@ -25,11 +25,6
25 25 class SplineChart: public Chart
26 26 {
27 27 public:
28
29 SplineChart(){
30 initialize();
31 }
32
33 28 QString name() { return QObject::tr("SplineChart"); }
34 29 QString category() { return QObject::tr("XYSeries"); }
35 30 QString subCategory() { return QString::null; }
@@ -26,11 +26,6
26 26 class VerticalBarChart: public Chart
27 27 {
28 28 public:
29
30 VerticalBarChart(){
31 initialize();
32 }
33
34 29 QString name() { return QObject::tr("VerticalBarChart"); }
35 30 QString category() { return QObject::tr("BarSeries"); }
36 31 QString subCategory() { return QObject::tr("Vertical"); }
@@ -26,11 +26,6
26 26 class VerticalStackedBarChart: public Chart
27 27 {
28 28 public:
29
30 VerticalStackedBarChart(){
31 initialize();
32 }
33
34 29 QString name() { return QObject::tr("VerticalStackedBarChart"); }
35 30 QString category() { return QObject::tr("BarSeries"); }
36 31 QString subCategory() { return QObject::tr("Vertical"); }
@@ -3,6 +3,6 include(charts/charts.pri)
3 3 TARGET = chartviewer
4 4 QT += opengl
5 5 INCLUDEPATH += .
6 SOURCES += main.cpp window.cpp view.cpp charts.cpp
6 SOURCES += main.cpp window.cpp view.cpp
7 7 HEADERS += window.h view.h charts.h model.h
8 8
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now