##// END OF EJS Templates
refactoring. QStackedBarSeries and QPercentBarSeries are now derived from QBarSeries.
sauimone -
r281:d81c37855aff
parent child
Show More
@@ -15,6 +15,7 class Separator;
15 class BarValue;
15 class BarValue;
16
16
17 // Common implemantation of different presenters. Not to be instantiated.
17 // Common implemantation of different presenters. Not to be instantiated.
18 // TODO: combine this with BarPresenter and derive others from it?
18 class BarPresenterBase : public QObject, public ChartItem
19 class BarPresenterBase : public QObject, public ChartItem
19 {
20 {
20 Q_OBJECT
21 Q_OBJECT
@@ -12,7 +12,6 class QBarSet;
12 class BarChartModel;
12 class BarChartModel;
13
13
14 // Container for series
14 // Container for series
15 // TODO: derive Stacked and percent bar charts from this?
16 class QTCOMMERCIALCHART_EXPORT QBarChartSeries : public QChartSeries
15 class QTCOMMERCIALCHART_EXPORT QBarChartSeries : public QChartSeries
17 {
16 {
18 Q_OBJECT
17 Q_OBJECT
@@ -52,7 +51,7 signals:
52
51
53 //public Q_SLOTS:
52 //public Q_SLOTS:
54
53
55 private:
54 protected:
56 BarChartModel* mModel;
55 BarChartModel* mModel;
57
56
58 };
57 };
@@ -8,11 +8,11
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
9
9
10 QPercentBarChartSeries::QPercentBarChartSeries(QBarCategory *category, QObject *parent)
10 QPercentBarChartSeries::QPercentBarChartSeries(QBarCategory *category, QObject *parent)
11 : QChartSeries(parent)
11 : QBarChartSeries(category, parent)
12 ,mModel(new BarChartModel(category, this))
12 // ,mModel(new BarChartModel(category, this))
13 {
13 {
14 }
14 }
15
15 /*
16 void QPercentBarChartSeries::addBarSet(QBarSet *set)
16 void QPercentBarChartSeries::addBarSet(QBarSet *set)
17 {
17 {
18 connect(this,SIGNAL(floatingValuesEnabled(bool)),set,SLOT(enableFloatingValues(bool)));
18 connect(this,SIGNAL(floatingValuesEnabled(bool)),set,SLOT(enableFloatingValues(bool)));
@@ -71,7 +71,7 BarChartModel& QPercentBarChartSeries::model()
71 {
71 {
72 return *mModel;
72 return *mModel;
73 }
73 }
74
74 */
75
75
76 #include "moc_qpercentbarchartseries.cpp"
76 #include "moc_qpercentbarchartseries.cpp"
77
77
@@ -3,7 +3,7
3
3
4 #include <QList>
4 #include <QList>
5 #include <QAbstractItemModel>
5 #include <QAbstractItemModel>
6 #include "qchartseries.h"
6 #include "qbarchartseries.h"
7
7
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
9
9
@@ -11,7 +11,8 class QBarCategory;
11 class QBarSet;
11 class QBarSet;
12 class BarChartModel;
12 class BarChartModel;
13
13
14 class QTCOMMERCIALCHART_EXPORT QPercentBarChartSeries : public QChartSeries
14 //class QTCOMMERCIALCHART_EXPORT QPercentBarChartSeries : public QChartSeries
15 class QTCOMMERCIALCHART_EXPORT QPercentBarChartSeries : public QBarChartSeries
15 {
16 {
16 Q_OBJECT
17 Q_OBJECT
17 public:
18 public:
@@ -19,7 +20,7 public:
19
20
20 // from BarChartSeriesBase
21 // from BarChartSeriesBase
21 virtual QChartSeriesType type() const { return QChartSeries::SeriesTypePercentBar; }
22 virtual QChartSeriesType type() const { return QChartSeries::SeriesTypePercentBar; }
22
23 /*
23 void addBarSet(QBarSet *set); // Takes ownership
24 void addBarSet(QBarSet *set); // Takes ownership
24 void removeBarSet(QBarSet *set); // Releases ownership, doesn't delete set
25 void removeBarSet(QBarSet *set); // Releases ownership, doesn't delete set
25 int countSets();
26 int countSets();
@@ -49,7 +50,7 public Q_SLOTS:
49
50
50 private:
51 private:
51 BarChartModel* mModel;
52 BarChartModel* mModel;
52
53 */
53 };
54 };
54
55
55 QTCOMMERCIALCHART_END_NAMESPACE
56 QTCOMMERCIALCHART_END_NAMESPACE
@@ -8,11 +8,11
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
9
9
10 QStackedBarChartSeries::QStackedBarChartSeries(QBarCategory *category, QObject *parent)
10 QStackedBarChartSeries::QStackedBarChartSeries(QBarCategory *category, QObject *parent)
11 : QChartSeries(parent)
11 : QBarChartSeries(category, parent)
12 ,mModel(new BarChartModel(category, this))
12 // ,mModel(new BarChartModel(category, this))
13 {
13 {
14 }
14 }
15
15 /*
16 void QStackedBarChartSeries::addBarSet(QBarSet *set)
16 void QStackedBarChartSeries::addBarSet(QBarSet *set)
17 {
17 {
18 connect(this,SIGNAL(floatingValuesEnabled(bool)),set,SLOT(enableFloatingValues(bool)));
18 connect(this,SIGNAL(floatingValuesEnabled(bool)),set,SLOT(enableFloatingValues(bool)));
@@ -71,7 +71,7 BarChartModel& QStackedBarChartSeries::model()
71 {
71 {
72 return *mModel;
72 return *mModel;
73 }
73 }
74
74 */
75
75
76 #include "moc_qstackedbarchartseries.cpp"
76 #include "moc_qstackedbarchartseries.cpp"
77
77
@@ -3,7 +3,7
3
3
4 #include <QList>
4 #include <QList>
5 #include <QAbstractItemModel>
5 #include <QAbstractItemModel>
6 #include "qchartseries.h"
6 #include "qbarchartseries.h"
7
7
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
9
9
@@ -11,7 +11,8 class QBarCategory;
11 class QBarSet;
11 class QBarSet;
12 class BarChartModel;
12 class BarChartModel;
13
13
14 class QTCOMMERCIALCHART_EXPORT QStackedBarChartSeries : public QChartSeries
14 //class QTCOMMERCIALCHART_EXPORT QStackedBarChartSeries : public QChartSeries
15 class QTCOMMERCIALCHART_EXPORT QStackedBarChartSeries : public QBarChartSeries
15 {
16 {
16 Q_OBJECT
17 Q_OBJECT
17 public:
18 public:
@@ -19,7 +20,7 public:
19
20
20 // from QChartSeries
21 // from QChartSeries
21 virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeStackedBar; }
22 virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeStackedBar; }
22
23 /*
23 // Set handling
24 // Set handling
24 void addBarSet(QBarSet *set); // Takes ownership
25 void addBarSet(QBarSet *set); // Takes ownership
25 void removeBarSet(QBarSet *set); // Releases ownership, doesn't delete set
26 void removeBarSet(QBarSet *set); // Releases ownership, doesn't delete set
@@ -49,6 +50,7 public Q_SLOTS:
49
50
50 private:
51 private:
51 BarChartModel* mModel;
52 BarChartModel* mModel;
53 */
52 };
54 };
53
55
54 QTCOMMERCIALCHART_END_NAMESPACE
56 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now