##// END OF EJS Templates
Renamed QSeries to QAbstractSeries
Tero Ahola -
r988:8a36a6921f5a
parent child
Show More
@@ -34,7 +34,7 DrilldownChart::~DrilldownChart()
34
34
35 }
35 }
36
36
37 void DrilldownChart::changeSeries(QSeries* series)
37 void DrilldownChart::changeSeries(QAbstractSeries* series)
38 {
38 {
39 // NOTE: if the series is owned by the chart it will be deleted
39 // NOTE: if the series is owned by the chart it will be deleted
40 // here the "window" owns the series...
40 // here the "window" owns the series...
@@ -23,7 +23,7
23 #include <QChart>
23 #include <QChart>
24
24
25 QTCOMMERCIALCHART_BEGIN_NAMESPACE
25 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26 class QSeries;
26 class QAbstractSeries;
27 class QPieSlice;
27 class QPieSlice;
28 QTCOMMERCIALCHART_END_NAMESPACE
28 QTCOMMERCIALCHART_END_NAMESPACE
29
29
@@ -35,13 +35,13 class DrilldownChart : public QChart
35 public:
35 public:
36 explicit DrilldownChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
36 explicit DrilldownChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
37 ~DrilldownChart();
37 ~DrilldownChart();
38 void changeSeries(QSeries* series);
38 void changeSeries(QAbstractSeries* series);
39
39
40 public Q_SLOTS:
40 public Q_SLOTS:
41 void handleSliceClicked(QPieSlice* slice);
41 void handleSliceClicked(QPieSlice* slice);
42
42
43 private:
43 private:
44 QSeries* m_currentSeries;
44 QAbstractSeries* m_currentSeries;
45 };
45 };
46
46
47 #endif // DRILLDOWNCHART_H
47 #endif // DRILLDOWNCHART_H
@@ -22,7 +22,7
22
22
23 QTCOMMERCIALCHART_USE_NAMESPACE
23 QTCOMMERCIALCHART_USE_NAMESPACE
24
24
25 DrilldownSlice::DrilldownSlice(qreal value, QString prefix, QSeries* drilldownSeries)
25 DrilldownSlice::DrilldownSlice(qreal value, QString prefix, QAbstractSeries* drilldownSeries)
26 :m_drilldownSeries(drilldownSeries),
26 :m_drilldownSeries(drilldownSeries),
27 m_prefix(prefix)
27 m_prefix(prefix)
28 {
28 {
@@ -39,7 +39,7 DrilldownSlice::~DrilldownSlice()
39
39
40 }
40 }
41
41
42 QSeries* DrilldownSlice::drilldownSeries() const
42 QAbstractSeries* DrilldownSlice::drilldownSeries() const
43 {
43 {
44 return m_drilldownSeries;
44 return m_drilldownSeries;
45 }
45 }
@@ -23,7 +23,7
23 #include <QPieSlice>
23 #include <QPieSlice>
24
24
25 QTCOMMERCIALCHART_BEGIN_NAMESPACE
25 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26 class QSeries;
26 class QAbstractSeries;
27 QTCOMMERCIALCHART_END_NAMESPACE
27 QTCOMMERCIALCHART_END_NAMESPACE
28
28
29 QTCOMMERCIALCHART_USE_NAMESPACE
29 QTCOMMERCIALCHART_USE_NAMESPACE
@@ -33,9 +33,9 class DrilldownSlice : public QPieSlice
33 Q_OBJECT
33 Q_OBJECT
34
34
35 public:
35 public:
36 DrilldownSlice(qreal value, QString prefix, QSeries* drilldownSeries);
36 DrilldownSlice(qreal value, QString prefix, QAbstractSeries* drilldownSeries);
37 virtual ~DrilldownSlice();
37 virtual ~DrilldownSlice();
38 QSeries* drilldownSeries() const;
38 QAbstractSeries* drilldownSeries() const;
39
39
40 public Q_SLOTS:
40 public Q_SLOTS:
41 void updateLabel();
41 void updateLabel();
@@ -43,7 +43,7 public Q_SLOTS:
43 void hideHighlight();
43 void hideHighlight();
44
44
45 private:
45 private:
46 QSeries* m_drilldownSeries;
46 QAbstractSeries* m_drilldownSeries;
47 QString m_prefix;
47 QString m_prefix;
48 };
48 };
49
49
@@ -79,7 +79,7 m_index(-1),m_chart(chart)
79 //![3]
79 //![3]
80
80
81 //![4]
81 //![4]
82 foreach (QSeries* series, m_series) {
82 foreach (QAbstractSeries* series, m_series) {
83 QObject::connect(series,SIGNAL(clicked(QPointF)),this,SLOT(handlePointClicked(QPointF)));
83 QObject::connect(series,SIGNAL(clicked(QPointF)),this,SLOT(handlePointClicked(QPointF)));
84 }
84 }
85 //![4]
85 //![4]
@@ -40,7 +40,7 public slots:
40
40
41 private:
41 private:
42 QTimer m_timer;
42 QTimer m_timer;
43 QList<QSeries*> m_series;
43 QList<QAbstractSeries *> m_series;
44 QStringList m_titles;
44 QStringList m_titles;
45 int m_index;
45 int m_index;
46 QChart *m_chart;
46 QChart *m_chart;
@@ -29,7 +29,7 DrilldownChart::DrilldownChart(QGraphicsItem *parent, Qt::WindowFlags wFlags)
29 {
29 {
30 }
30 }
31
31
32 void DrilldownChart::changeSeries(QSeries* series)
32 void DrilldownChart::changeSeries(QAbstractSeries *series)
33 {
33 {
34 if (m_currentSeries)
34 if (m_currentSeries)
35 removeSeries(m_currentSeries);
35 removeSeries(m_currentSeries);
@@ -33,13 +33,13 class DrilldownChart : public QChart
33 public:
33 public:
34 explicit DrilldownChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
34 explicit DrilldownChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
35
35
36 void changeSeries(QSeries* series);
36 void changeSeries(QAbstractSeries *series);
37
37
38 public Q_SLOTS:
38 public Q_SLOTS:
39 void handleClicked(QBarSet *barset, QString category, Qt::MouseButtons button);
39 void handleClicked(QBarSet *barset, QString category, Qt::MouseButtons button);
40
40
41 private:
41 private:
42 QSeries* m_currentSeries;
42 QAbstractSeries* m_currentSeries;
43 };
43 };
44 //! [2]
44 //! [2]
45
45
@@ -30,7 +30,7 DeclarativeAreaSeries::DeclarativeAreaSeries(QObject *parent) :
30 {
30 {
31 }
31 }
32
32
33 QSeries *DeclarativeAreaSeries::series()
33 QAbstractSeries *DeclarativeAreaSeries::series()
34 {
34 {
35 return this;
35 return this;
36 }
36 }
@@ -37,7 +37,7 public:
37 explicit DeclarativeAreaSeries(QObject *parent = 0);
37 explicit DeclarativeAreaSeries(QObject *parent = 0);
38
38
39 public:
39 public:
40 QSeries *series();
40 QAbstractSeries *series();
41 QDeclarativeListProperty<DeclarativeXyPoint> points();
41 QDeclarativeListProperty<DeclarativeXyPoint> points();
42 QDeclarativeListProperty<DeclarativeXyPoint> lowerPoints();
42 QDeclarativeListProperty<DeclarativeXyPoint> lowerPoints();
43
43
@@ -30,7 +30,7 DeclarativeLineSeries::DeclarativeLineSeries(QObject *parent) :
30 {
30 {
31 }
31 }
32
32
33 QSeries *DeclarativeLineSeries::series()
33 QAbstractSeries *DeclarativeLineSeries::series()
34 {
34 {
35 return this;
35 return this;
36 }
36 }
@@ -37,7 +37,7 public:
37 explicit DeclarativeLineSeries(QObject *parent = 0);
37 explicit DeclarativeLineSeries(QObject *parent = 0);
38
38
39 public:
39 public:
40 QSeries *series();
40 QAbstractSeries *series();
41 QDeclarativeListProperty<DeclarativeXyPoint> points();
41 QDeclarativeListProperty<DeclarativeXyPoint> points();
42 };
42 };
43
43
@@ -30,7 +30,7 DeclarativeScatterSeries::DeclarativeScatterSeries(QObject *parent) :
30 {
30 {
31 }
31 }
32
32
33 QSeries *DeclarativeScatterSeries::series()
33 QAbstractSeries *DeclarativeScatterSeries::series()
34 {
34 {
35 return this;
35 return this;
36 }
36 }
@@ -37,7 +37,7 public:
37 explicit DeclarativeScatterSeries(QObject *parent = 0);
37 explicit DeclarativeScatterSeries(QObject *parent = 0);
38
38
39 public:
39 public:
40 QSeries *series();
40 QAbstractSeries *series();
41 QDeclarativeListProperty<DeclarativeXyPoint> points();
41 QDeclarativeListProperty<DeclarativeXyPoint> points();
42 };
42 };
43
43
@@ -29,7 +29,7 DeclarativeSplineSeries::DeclarativeSplineSeries(QObject *parent) :
29 {
29 {
30 }
30 }
31
31
32 QSeries *DeclarativeSplineSeries::series()
32 QAbstractSeries *DeclarativeSplineSeries::series()
33 {
33 {
34 return this;
34 return this;
35 }
35 }
@@ -37,7 +37,7 public:
37 explicit DeclarativeSplineSeries(QObject *parent = 0);
37 explicit DeclarativeSplineSeries(QObject *parent = 0);
38
38
39 public:
39 public:
40 QSeries *series();
40 QAbstractSeries *series();
41 QDeclarativeListProperty<DeclarativeXyPoint> points();
41 QDeclarativeListProperty<DeclarativeXyPoint> points();
42 };
42 };
43
43
@@ -39,7 +39,7 void DeclarativeXySeries::classBegin()
39
39
40 void DeclarativeXySeries::componentComplete()
40 void DeclarativeXySeries::componentComplete()
41 {
41 {
42 QSeries *thisObj = reinterpret_cast<QSeries *>(series());
42 QAbstractSeries *thisObj = reinterpret_cast<QAbstractSeries *>(series());
43 DeclarativeChart *declarativeChart = qobject_cast<DeclarativeChart *>(thisObj->parent());
43 DeclarativeChart *declarativeChart = qobject_cast<DeclarativeChart *>(thisObj->parent());
44
44
45 if (declarativeChart) {
45 if (declarativeChart) {
@@ -29,7 +29,7
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30
30
31 class QChart;
31 class QChart;
32 class QSeries;
32 class QAbstractSeries;
33
33
34 class DeclarativeXySeries : public QDeclarativeParserStatus
34 class DeclarativeXySeries : public QDeclarativeParserStatus
35 {
35 {
@@ -44,7 +44,7 public: // from QDeclarativeParserStatus
44 virtual void componentComplete();
44 virtual void componentComplete();
45
45
46 public:
46 public:
47 virtual QSeries *series() = 0;
47 virtual QAbstractSeries *series() = 0;
48 virtual QDeclarativeListProperty<DeclarativeXyPoint> points() = 0;
48 virtual QDeclarativeListProperty<DeclarativeXyPoint> points() = 0;
49
49
50 public Q_SLOTS:
50 public Q_SLOTS:
@@ -58,7 +58,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
58 /*!
58 /*!
59 \fn virtual QSeriesType QAreaSeries::type() const
59 \fn virtual QSeriesType QAreaSeries::type() const
60 \brief Returns type of series.
60 \brief Returns type of series.
61 \sa QSeries, QSeriesType
61 \sa QAbstractSeries, QSeriesType
62 */
62 */
63
63
64 /*!
64 /*!
@@ -113,7 +113,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
113 When series object is added to QChartView or QChart instance ownerships is transferred.
113 When series object is added to QChartView or QChart instance ownerships is transferred.
114 */
114 */
115 QAreaSeries::QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries)
115 QAreaSeries::QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries)
116 : QSeries(*new QAreaSeriesPrivate(upperSeries,lowerSeries,this),upperSeries)
116 : QAbstractSeries(*new QAreaSeriesPrivate(upperSeries,lowerSeries,this),upperSeries)
117 {
117 {
118 }
118 }
119
119
@@ -126,9 +126,9 QAreaSeries::~QAreaSeries()
126 }
126 }
127
127
128
128
129 QSeries::QSeriesType QAreaSeries::type() const
129 QAbstractSeries::QSeriesType QAreaSeries::type() const
130 {
130 {
131 return QSeries::SeriesTypeArea;
131 return QAbstractSeries::SeriesTypeArea;
132 }
132 }
133
133
134 QLineSeries* QAreaSeries::upperSeries() const
134 QLineSeries* QAreaSeries::upperSeries() const
@@ -211,7 +211,7 QAbstractItemModel* QAreaSeries::model() const
211 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
211 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
212
212
213 QAreaSeriesPrivate::QAreaSeriesPrivate(QLineSeries *upperSeries, QLineSeries *lowerSeries,QAreaSeries* q) :
213 QAreaSeriesPrivate::QAreaSeriesPrivate(QLineSeries *upperSeries, QLineSeries *lowerSeries,QAreaSeries* q) :
214 QSeriesPrivate(q),
214 QAbstractSeriesPrivate(q),
215 m_upperSeries(upperSeries),
215 m_upperSeries(upperSeries),
216 m_lowerSeries(lowerSeries),
216 m_lowerSeries(lowerSeries),
217 m_pointsVisible(false)
217 m_pointsVisible(false)
@@ -22,7 +22,7
22 #define QAREASERIES_H
22 #define QAREASERIES_H
23
23
24 #include <qchartglobal.h>
24 #include <qchartglobal.h>
25 #include <qseries.h>
25 #include <qabstractseries.h>
26 #include <QPen>
26 #include <QPen>
27 #include <QBrush>
27 #include <QBrush>
28
28
@@ -30,7 +30,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30 class QLineSeries;
30 class QLineSeries;
31 class QAreaSeriesPrivate;
31 class QAreaSeriesPrivate;
32
32
33 class QTCOMMERCIALCHART_EXPORT QAreaSeries : public QSeries
33 class QTCOMMERCIALCHART_EXPORT QAreaSeries : public QAbstractSeries
34 {
34 {
35 Q_OBJECT
35 Q_OBJECT
36 public:
36 public:
@@ -38,7 +38,7 public:
38 ~QAreaSeries();
38 ~QAreaSeries();
39
39
40 public:
40 public:
41 QSeries::QSeriesType type() const;
41 QAbstractSeries::QSeriesType type() const;
42
42
43 QLineSeries* upperSeries() const;
43 QLineSeries* upperSeries() const;
44 QLineSeries* lowerSeries() const;
44 QLineSeries* lowerSeries() const;
@@ -30,13 +30,13
30 #ifndef QAREASERIES_P_H
30 #ifndef QAREASERIES_P_H
31 #define QAREASERIES_P_H
31 #define QAREASERIES_P_H
32
32
33 #include "qseries_p.h"
33 #include "qabstractseries_p.h"
34
34
35 QTCOMMERCIALCHART_BEGIN_NAMESPACE
35 QTCOMMERCIALCHART_BEGIN_NAMESPACE
36
36
37 class QAreaSeries;
37 class QAreaSeries;
38
38
39 class QAreaSeriesPrivate: public QSeriesPrivate
39 class QAreaSeriesPrivate: public QAbstractSeriesPrivate
40 {
40 {
41 Q_OBJECT
41 Q_OBJECT
42
42
@@ -24,7 +24,7
24 #include <QObject>
24 #include <QObject>
25 #include <QStringList>
25 #include <QStringList>
26 #include "qchartglobal.h"
26 #include "qchartglobal.h"
27 #include <qseries.h>
27 #include <qabstractseries.h>
28
28
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30
30
@@ -74,7 +74,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
74 QBarSeries is QObject which is a child of a \a parent.
74 QBarSeries is QObject which is a child of a \a parent.
75 */
75 */
76 QBarSeries::QBarSeries(QBarCategories categories, QObject *parent) :
76 QBarSeries::QBarSeries(QBarCategories categories, QObject *parent) :
77 QSeries(*new QBarSeriesPrivate(categories, this),parent)
77 QAbstractSeries(*new QBarSeriesPrivate(categories, this),parent)
78 {
78 {
79 }
79 }
80
80
@@ -90,16 +90,16 QBarSeries::~QBarSeries()
90 \internal
90 \internal
91 */
91 */
92 QBarSeries::QBarSeries(QBarSeriesPrivate &d, QObject *parent) :
92 QBarSeries::QBarSeries(QBarSeriesPrivate &d, QObject *parent) :
93 QSeries(d,parent)
93 QAbstractSeries(d,parent)
94 {
94 {
95 }
95 }
96
96
97 /*!
97 /*!
98 Returns the type of series. Derived classes override this.
98 Returns the type of series. Derived classes override this.
99 */
99 */
100 QSeries::QSeriesType QBarSeries::type() const
100 QAbstractSeries::QSeriesType QBarSeries::type() const
101 {
101 {
102 return QSeries::SeriesTypeBar;
102 return QAbstractSeries::SeriesTypeBar;
103 }
103 }
104
104
105 /*!
105 /*!
@@ -269,7 +269,8 void QBarSeries::setLabelsVisible(bool visible)
269
269
270 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
270 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
271
271
272 QBarSeriesPrivate::QBarSeriesPrivate(QBarCategories categories, QBarSeries *q) : QSeriesPrivate(q),
272 QBarSeriesPrivate::QBarSeriesPrivate(QBarCategories categories, QBarSeries *q) :
273 QAbstractSeriesPrivate(q),
273 m_internalModel(new BarChartModel(categories,this)),
274 m_internalModel(new BarChartModel(categories,this)),
274 m_model(0),
275 m_model(0),
275 m_mapCategories(-1),
276 m_mapCategories(-1),
@@ -21,7 +21,7
21 #ifndef BARSERIES_H
21 #ifndef BARSERIES_H
22 #define BARSERIES_H
22 #define BARSERIES_H
23
23
24 #include <qseries.h>
24 #include <qabstractseries.h>
25 #include <QStringList>
25 #include <QStringList>
26
26
27 class QModelIndex;
27 class QModelIndex;
@@ -36,14 +36,14 class BarCategory;
36 class QBarSeriesPrivate;
36 class QBarSeriesPrivate;
37
37
38 // Container for series
38 // Container for series
39 class QTCOMMERCIALCHART_EXPORT QBarSeries : public QSeries
39 class QTCOMMERCIALCHART_EXPORT QBarSeries : public QAbstractSeries
40 {
40 {
41 Q_OBJECT
41 Q_OBJECT
42 public:
42 public:
43 explicit QBarSeries(QBarCategories categories, QObject *parent = 0);
43 explicit QBarSeries(QBarCategories categories, QObject *parent = 0);
44 virtual ~QBarSeries();
44 virtual ~QBarSeries();
45
45
46 QSeries::QSeriesType type() const;
46 QAbstractSeries::QSeriesType type() const;
47
47
48 void appendBarSet(QBarSet *set); // Takes ownership of set
48 void appendBarSet(QBarSet *set); // Takes ownership of set
49 void removeBarSet(QBarSet *set); // Releases ownership, doesn't delete set
49 void removeBarSet(QBarSet *set); // Releases ownership, doesn't delete set
@@ -2,16 +2,16
2 #define QBARSERIES_P_H
2 #define QBARSERIES_P_H
3
3
4 #include "qbarseries.h"
4 #include "qbarseries.h"
5 #include "qseries_p.h"
5 #include "qabstractseries_p.h"
6 #include <QStringList>
6 #include <QStringList>
7 #include <QSeries>
7 #include <QAbstractSeries>
8
8
9 class QModelIndex;
9 class QModelIndex;
10
10
11 QTCOMMERCIALCHART_BEGIN_NAMESPACE
11 QTCOMMERCIALCHART_BEGIN_NAMESPACE
12
12
13 // Container for series
13 // Container for series
14 class QBarSeriesPrivate : public QSeriesPrivate
14 class QBarSeriesPrivate : public QAbstractSeriesPrivate
15 {
15 {
16 Q_OBJECT
16 Q_OBJECT
17 public:
17 public:
@@ -44,7 +44,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
44 /*!
44 /*!
45 \fn virtual QSeriesType QPercentBarSeries::type() const
45 \fn virtual QSeriesType QPercentBarSeries::type() const
46 \brief Returns type of series.
46 \brief Returns type of series.
47 \sa QSeries, QSeriesType
47 \sa QAbstractSeries, QSeriesType
48 */
48 */
49
49
50 /*!
50 /*!
@@ -56,9 +56,9 QPercentBarSeries::QPercentBarSeries(QBarCategories categories, QObject *parent)
56 {
56 {
57 }
57 }
58
58
59 QSeries::QSeriesType QPercentBarSeries::type() const
59 QAbstractSeries::QSeriesType QPercentBarSeries::type() const
60 {
60 {
61 return QSeries::SeriesTypePercentBar;
61 return QAbstractSeries::SeriesTypePercentBar;
62 }
62 }
63
63
64 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
64 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -33,7 +33,7 class QTCOMMERCIALCHART_EXPORT QPercentBarSeries : public QBarSeries
33 Q_OBJECT
33 Q_OBJECT
34 public:
34 public:
35 explicit QPercentBarSeries(QBarCategories categories, QObject *parent = 0);
35 explicit QPercentBarSeries(QBarCategories categories, QObject *parent = 0);
36 QSeries::QSeriesType type() const;
36 QAbstractSeries::QSeriesType type() const;
37 private:
37 private:
38 Q_DECLARE_PRIVATE(QPercentBarSeries)
38 Q_DECLARE_PRIVATE(QPercentBarSeries)
39 Q_DISABLE_COPY(QPercentBarSeries)
39 Q_DISABLE_COPY(QPercentBarSeries)
@@ -44,7 +44,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
44 /*!
44 /*!
45 \fn virtual QSeriesType QStackedBarSeries::type() const
45 \fn virtual QSeriesType QStackedBarSeries::type() const
46 \brief Returns type of series.
46 \brief Returns type of series.
47 \sa QSeries, QSeriesType
47 \sa QSeriesType
48 */
48 */
49
49
50 /*!
50 /*!
@@ -56,9 +56,9 QStackedBarSeries::QStackedBarSeries(QBarCategories categories, QObject *parent)
56 {
56 {
57 }
57 }
58
58
59 QSeries::QSeriesType QStackedBarSeries::type() const
59 QAbstractSeries::QSeriesType QStackedBarSeries::type() const
60 {
60 {
61 return QSeries::SeriesTypeStackedBar;
61 return QAbstractSeries::SeriesTypeStackedBar;
62 }
62 }
63
63
64 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
64 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -33,7 +33,7 class QTCOMMERCIALCHART_EXPORT QStackedBarSeries : public QBarSeries
33 Q_OBJECT
33 Q_OBJECT
34 public:
34 public:
35 explicit QStackedBarSeries(QBarCategories categories, QObject *parent = 0);
35 explicit QStackedBarSeries(QBarCategories categories, QObject *parent = 0);
36 QSeries::QSeriesType type() const;
36 QAbstractSeries::QSeriesType type() const;
37 private:
37 private:
38 Q_DECLARE_PRIVATE(QStackedBarSeries)
38 Q_DECLARE_PRIVATE(QStackedBarSeries)
39 Q_DISABLE_COPY(QStackedBarSeries)
39 Q_DISABLE_COPY(QStackedBarSeries)
@@ -21,7 +21,7
21 #include "chartdataset_p.h"
21 #include "chartdataset_p.h"
22 #include "qchartaxis.h"
22 #include "qchartaxis.h"
23 #include "qchartaxis_p.h"
23 #include "qchartaxis_p.h"
24 #include "qseries_p.h"
24 #include "qabstractseries_p.h"
25 #include "qbarseries.h"
25 #include "qbarseries.h"
26 #include "qstackedbarseries.h"
26 #include "qstackedbarseries.h"
27 #include "qpercentbarseries.h"
27 #include "qpercentbarseries.h"
@@ -41,7 +41,7 ChartDataSet::~ChartDataSet()
41 {
41 {
42 }
42 }
43
43
44 void ChartDataSet::addSeries(QSeries* series, QChartAxis *axisY)
44 void ChartDataSet::addSeries(QAbstractSeries* series, QChartAxis *axisY)
45 {
45 {
46 if(axisY==0) axisY = m_axisY;
46 if(axisY==0) axisY = m_axisY;
47
47
@@ -75,21 +75,21 void ChartDataSet::addSeries(QSeries* series, QChartAxis *axisY)
75
75
76 series->d_ptr->scaleDomain(*domain);
76 series->d_ptr->scaleDomain(*domain);
77
77
78 if(series->type() == QSeries::SeriesTypeBar || series->type() == QSeries::SeriesTypeStackedBar || series->type() == QSeries::SeriesTypePercentBar)
78 if(series->type() == QAbstractSeries::SeriesTypeBar
79 {
79 || series->type() == QAbstractSeries::SeriesTypeStackedBar
80 || series->type() == QAbstractSeries::SeriesTypePercentBar) {
80 QBarSeries* barSeries = static_cast<QBarSeries*>(series);
81 QBarSeries* barSeries = static_cast<QBarSeries*>(series);
81 setupCategories(barSeries);
82 setupCategories(barSeries);
82 }
83 }
83
84
84 if (series->type()== QSeries::SeriesTypePie && m_seriesAxisMap.count()==0)
85 if (series->type()== QAbstractSeries::SeriesTypePie && m_seriesAxisMap.count() == 0) {
85 {
86 axisX()->hide();
86 axisX()->hide();
87 this->axisY()->hide();
87 this->axisY()->hide();
88 }
88 }
89
89
90 m_seriesAxisMap.insert(series,axisY);
90 m_seriesAxisMap.insert(series,axisY);
91
91
92 QMapIterator<int, QSeries*> i(m_indexSeriesMap);
92 QMapIterator<int, QAbstractSeries*> i(m_indexSeriesMap);
93
93
94 int key=0;
94 int key=0;
95 while (i.hasNext()) {
95 while (i.hasNext()) {
@@ -106,7 +106,7 void ChartDataSet::addSeries(QSeries* series, QChartAxis *axisY)
106
106
107 }
107 }
108
108
109 QChartAxis* ChartDataSet::removeSeries(QSeries* series)
109 QChartAxis* ChartDataSet::removeSeries(QAbstractSeries* series)
110 {
110 {
111 QChartAxis* axis = m_seriesAxisMap.value(series);
111 QChartAxis* axis = m_seriesAxisMap.value(series);
112
112
@@ -148,9 +148,9 QChartAxis* ChartDataSet::removeSeries(QSeries* series)
148
148
149 void ChartDataSet::removeAllSeries()
149 void ChartDataSet::removeAllSeries()
150 {
150 {
151 QList<QSeries*> series = m_seriesAxisMap.keys();
151 QList<QAbstractSeries*> series = m_seriesAxisMap.keys();
152 QList<QChartAxis*> axes;
152 QList<QChartAxis*> axes;
153 foreach(QSeries* s , series) {
153 foreach(QAbstractSeries *s , series) {
154 QChartAxis* axis = removeSeries(s);
154 QChartAxis* axis = removeSeries(s);
155 if(axis==axisY()) continue;
155 if(axis==axisY()) continue;
156 int i = axes.indexOf(axis);
156 int i = axes.indexOf(axis);
@@ -191,10 +191,10 void ChartDataSet::zoomOutDomain(const QRectF& rect, const QSizeF& size)
191 }
191 }
192 }
192 }
193
193
194 int ChartDataSet::seriesCount(QSeries::QSeriesType type)
194 int ChartDataSet::seriesCount(QAbstractSeries::QSeriesType type)
195 {
195 {
196 int count=0;
196 int count=0;
197 QMapIterator<QSeries*, QChartAxis*> i(m_seriesAxisMap);
197 QMapIterator<QAbstractSeries*, QChartAxis*> i(m_seriesAxisMap);
198 while (i.hasNext()) {
198 while (i.hasNext()) {
199 i.next();
199 i.next();
200 if(i.key()->type()==type) count++;
200 if(i.key()->type()==type) count++;
@@ -202,9 +202,9 int ChartDataSet::seriesCount(QSeries::QSeriesType type)
202 return count;
202 return count;
203 }
203 }
204
204
205 int ChartDataSet::seriesIndex(QSeries *series)
205 int ChartDataSet::seriesIndex(QAbstractSeries *series)
206 {
206 {
207 QMapIterator<int, QSeries*> i(m_indexSeriesMap);
207 QMapIterator<int, QAbstractSeries*> i(m_indexSeriesMap);
208 while (i.hasNext()) {
208 while (i.hasNext()) {
209 i.next();
209 i.next();
210 if (i.value() == series)
210 if (i.value() == series)
@@ -213,13 +213,13 int ChartDataSet::seriesIndex(QSeries *series)
213 return -1;
213 return -1;
214 }
214 }
215
215
216 QChartAxis* ChartDataSet::axisY(QSeries* series) const
216 QChartAxis* ChartDataSet::axisY(QAbstractSeries *series) const
217 {
217 {
218 if(series == 0) return m_axisY;
218 if(series == 0) return m_axisY;
219 return m_seriesAxisMap.value(series);
219 return m_seriesAxisMap.value(series);
220 }
220 }
221
221
222 Domain* ChartDataSet::domain(QSeries* series) const
222 Domain* ChartDataSet::domain(QAbstractSeries *series) const
223 {
223 {
224 QChartAxis* axis = m_seriesAxisMap.value(series);
224 QChartAxis* axis = m_seriesAxisMap.value(series);
225 if(axis){
225 if(axis){
@@ -30,7 +30,7
30 #ifndef CHARTDATASET_P_H
30 #ifndef CHARTDATASET_P_H
31 #define CHARTDATASET_P_H
31 #define CHARTDATASET_P_H
32
32
33 #include "qseries.h"
33 #include "qabstractseries.h"
34 #include "domain_p.h"
34 #include "domain_p.h"
35 #include <QVector>
35 #include <QVector>
36
36
@@ -46,38 +46,38 public:
46 ChartDataSet(QObject* parent=0);
46 ChartDataSet(QObject* parent=0);
47 virtual ~ChartDataSet();
47 virtual ~ChartDataSet();
48
48
49 void addSeries(QSeries* series,QChartAxis *axisY = 0);
49 void addSeries(QAbstractSeries* series,QChartAxis *axisY = 0);
50 QChartAxis* removeSeries(QSeries* series);
50 QChartAxis* removeSeries(QAbstractSeries* series);
51 void removeAllSeries();
51 void removeAllSeries();
52
52
53 void zoomInDomain(const QRectF& rect, const QSizeF& size);
53 void zoomInDomain(const QRectF& rect, const QSizeF& size);
54 void zoomOutDomain(const QRectF& rect, const QSizeF& size);
54 void zoomOutDomain(const QRectF& rect, const QSizeF& size);
55 void scrollDomain(int dx,int dy,const QSizeF& size);
55 void scrollDomain(int dx,int dy,const QSizeF& size);
56
56
57 int seriesCount(QSeries::QSeriesType type);
57 int seriesCount(QAbstractSeries::QSeriesType type);
58 int seriesIndex(QSeries *series);
58 int seriesIndex(QAbstractSeries *series);
59
59
60 Domain* domain(QSeries* series) const;
60 Domain* domain(QAbstractSeries* series) const;
61 Domain* domain(QChartAxis* axis) const;
61 Domain* domain(QChartAxis* axis) const;
62
62
63 QChartAxis* axisX() const { return m_axisX; }
63 QChartAxis* axisX() const { return m_axisX; }
64 QChartAxis* axisY(QSeries* series = 0) const;
64 QChartAxis* axisY(QAbstractSeries *series = 0) const;
65
65
66 Q_SIGNALS:
66 Q_SIGNALS:
67 void seriesAdded(QSeries* series,Domain* domain);
67 void seriesAdded(QAbstractSeries* series, Domain* domain);
68 void seriesRemoved(QSeries* series);
68 void seriesRemoved(QAbstractSeries* series);
69 void axisAdded(QChartAxis* axis,Domain* domain);
69 void axisAdded(QChartAxis* axis,Domain* domain);
70 void axisRemoved(QChartAxis* axis);
70 void axisRemoved(QChartAxis* axis);
71
71
72 private:
72 private:
73 QStringList createLabels(QChartAxis* axis,qreal min, qreal max);
73 QStringList createLabels(QChartAxis* axis,qreal min, qreal max);
74 void calculateDomain(QSeries* series,Domain* domain);
74 void calculateDomain(QAbstractSeries* series,Domain* domain);
75 void setupCategories(QBarSeries* series);
75 void setupCategories(QBarSeries* series);
76
76
77 private:
77 private:
78 QMap<QSeries*, QChartAxis*> m_seriesAxisMap;
78 QMap<QAbstractSeries *, QChartAxis *> m_seriesAxisMap;
79 QMap<QChartAxis*, Domain*> m_axisDomainMap;
79 QMap<QChartAxis*, Domain *> m_axisDomainMap;
80 QMap<int,QSeries*> m_indexSeriesMap;
80 QMap<int, QAbstractSeries *> m_indexSeriesMap;
81 QChartAxis* m_axisX;
81 QChartAxis* m_axisX;
82 QChartAxis* m_axisY;
82 QChartAxis* m_axisY;
83
83
@@ -24,7 +24,7
24 #include "chartdataset_p.h"
24 #include "chartdataset_p.h"
25 #include "charttheme_p.h"
25 #include "charttheme_p.h"
26 #include "chartanimator_p.h"
26 #include "chartanimator_p.h"
27 #include "qseries_p.h"
27 #include "qabstractseries_p.h"
28 #include "qareaseries.h"
28 #include "qareaseries.h"
29 #include "axis_p.h"
29 #include "axis_p.h"
30 #include "areachartitem_p.h"
30 #include "areachartitem_p.h"
@@ -146,7 +146,7 void ChartPresenter::handleAxisRemoved(QChartAxis* axis)
146 }
146 }
147
147
148
148
149 void ChartPresenter::handleSeriesAdded(QSeries* series,Domain* domain)
149 void ChartPresenter::handleSeriesAdded(QAbstractSeries* series,Domain* domain)
150 {
150 {
151 Chart *item = series->d_ptr->createGraphics(this);
151 Chart *item = series->d_ptr->createGraphics(this);
152 Q_ASSERT(item);
152 Q_ASSERT(item);
@@ -158,13 +158,13 void ChartPresenter::handleSeriesAdded(QSeries* series,Domain* domain)
158 m_chartItems.insert(series,item);
158 m_chartItems.insert(series,item);
159 }
159 }
160
160
161 void ChartPresenter::handleSeriesRemoved(QSeries* series)
161 void ChartPresenter::handleSeriesRemoved(QAbstractSeries* series)
162 {
162 {
163 Chart* item = m_chartItems.take(series);
163 Chart* item = m_chartItems.take(series);
164 Q_ASSERT(item);
164 Q_ASSERT(item);
165 if(m_animator) {
165 if(m_animator) {
166 //small hack to handle area animations
166 //small hack to handle area animations
167 if(series->type()==QSeries::SeriesTypeArea){
167 if(series->type() == QAbstractSeries::SeriesTypeArea){
168 QAreaSeries* areaSeries = static_cast<QAreaSeries*>(series);
168 QAreaSeries* areaSeries = static_cast<QAreaSeries*>(series);
169 AreaChartItem* area = static_cast<AreaChartItem*>(item);
169 AreaChartItem* area = static_cast<AreaChartItem*>(item);
170 m_animator->removeAnimation(area->upperLineItem());
170 m_animator->removeAnimation(area->upperLineItem());
@@ -208,13 +208,13 void ChartPresenter::setAnimationOptions(QChart::AnimationOptions options)
208 void ChartPresenter::resetAllElements()
208 void ChartPresenter::resetAllElements()
209 {
209 {
210 QList<QChartAxis*> axisList = m_axisItems.uniqueKeys();
210 QList<QChartAxis *> axisList = m_axisItems.uniqueKeys();
211 QList<QSeries*> seriesList = m_chartItems.uniqueKeys();
211 QList<QAbstractSeries *> seriesList = m_chartItems.uniqueKeys();
212
212
213 foreach(QChartAxis* axis, axisList) {
213 foreach(QChartAxis *axis, axisList) {
214 handleAxisRemoved(axis);
214 handleAxisRemoved(axis);
215 handleAxisAdded(axis,m_dataset->domain(axis));
215 handleAxisAdded(axis,m_dataset->domain(axis));
216 }
216 }
217 foreach(QSeries* series, seriesList) {
217 foreach(QAbstractSeries *series, seriesList) {
218 handleSeriesRemoved(series);
218 handleSeriesRemoved(series);
219 handleSeriesAdded(series,m_dataset->domain(series));
219 handleSeriesAdded(series,m_dataset->domain(series));
220 }
220 }
@@ -30,7 +30,7
30 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30 QTCOMMERCIALCHART_BEGIN_NAMESPACE
31
31
32 class Chart;
32 class Chart;
33 class QSeries;
33 class QAbstractSeries;
34 class ChartDataSet;
34 class ChartDataSet;
35 class Domain;
35 class Domain;
36 class Axis;
36 class Axis;
@@ -87,8 +87,8 public: //TODO: fix me
87 QRectF margins() const { return m_chartMargins;}
87 QRectF margins() const { return m_chartMargins;}
88
88
89 public Q_SLOTS:
89 public Q_SLOTS:
90 void handleSeriesAdded(QSeries* series,Domain* domain);
90 void handleSeriesAdded(QAbstractSeries* series,Domain* domain);
91 void handleSeriesRemoved(QSeries* series);
91 void handleSeriesRemoved(QAbstractSeries* series);
92 void handleAxisAdded(QChartAxis* axis,Domain* domain);
92 void handleAxisAdded(QChartAxis* axis,Domain* domain);
93 void handleAxisRemoved(QChartAxis* axis);
93 void handleAxisRemoved(QChartAxis* axis);
94 void updateLayout();
94 void updateLayout();
@@ -102,7 +102,7 private:
102 ChartAnimator* m_animator;
102 ChartAnimator* m_animator;
103 ChartDataSet* m_dataset;
103 ChartDataSet* m_dataset;
104 ChartTheme *m_chartTheme;
104 ChartTheme *m_chartTheme;
105 QMap<QSeries*,Chart*> m_chartItems;
105 QMap<QAbstractSeries *, Chart *> m_chartItems;
106 QMap<QChartAxis*,Axis*> m_axisItems;
106 QMap<QChartAxis *, Axis *> m_axisItems;
107 QRectF m_rect;
107 QRectF m_rect;
108 QRectF m_chartRect;
108 QRectF m_chartRect;
@@ -29,7 +29,6
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30
30
31 class ChartItem;
31 class ChartItem;
32 class QSeries;
33 class LineChartItem;
32 class LineChartItem;
34 class QLineSeries;
33 class QLineSeries;
35 class BarChartItem;
34 class BarChartItem;
@@ -35,7 +35,7
35
35
36 QTCOMMERCIALCHART_BEGIN_NAMESPACE
36 QTCOMMERCIALCHART_BEGIN_NAMESPACE
37
37
38 LegendMarker::LegendMarker(QSeries* series,QLegend *legend) : QGraphicsObject(legend),
38 LegendMarker::LegendMarker(QAbstractSeries *series, QLegend *legend) : QGraphicsObject(legend),
39 m_series(series),
39 m_series(series),
40 m_markerRect(0,0,10.0,10.0),
40 m_markerRect(0,0,10.0,10.0),
41 m_boundingRect(0,0,0,0),
41 m_boundingRect(0,0,0,0),
@@ -179,7 +179,7 void XYLegendMarker::updated()
179 {
179 {
180 setLabel(m_series->name());
180 setLabel(m_series->name());
181
181
182 if(m_series->type()== QSeries::SeriesTypeScatter)
182 if(m_series->type()== QAbstractSeries::SeriesTypeScatter)
183 {
183 {
184 setBrush(m_series->brush());
184 setBrush(m_series->brush());
185
185
@@ -29,7 +29,7
29
29
30 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30 QTCOMMERCIALCHART_BEGIN_NAMESPACE
31
31
32 class QSeries;
32 class QAbstractSeries;
33 class QAreaSeries;
33 class QAreaSeries;
34 class QXYSeries;
34 class QXYSeries;
35 class QBarSet;
35 class QBarSet;
@@ -43,7 +43,7 class LegendMarker : public QGraphicsObject
43 Q_OBJECT
43 Q_OBJECT
44
44
45 public:
45 public:
46 explicit LegendMarker(QSeries* m_series,QLegend *parent);
46 explicit LegendMarker(QAbstractSeries *m_series, QLegend *parent);
47
47
48 void setPen(const QPen &pen);
48 void setPen(const QPen &pen);
49 QPen pen() const;
49 QPen pen() const;
@@ -55,7 +55,7 public:
55 void setLabel(const QString label);
55 void setLabel(const QString label);
56 QString label() const;
56 QString label() const;
57
57
58 QSeries* series() const { return m_series;}
58 QAbstractSeries *series() const { return m_series;}
59
59
60 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
60 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
61
61
@@ -74,7 +74,7 public Q_SLOTS:
74 virtual void updated() = 0;
74 virtual void updated() = 0;
75
75
76 protected:
76 protected:
77 QSeries* m_series;
77 QAbstractSeries *m_series;
78 QRectF m_markerRect;
78 QRectF m_markerRect;
79 QRectF m_boundingRect;
79 QRectF m_boundingRect;
80 QLegend* m_legend;
80 QLegend* m_legend;
@@ -20,8 +20,8
20
20
21 #include "qlegend.h"
21 #include "qlegend.h"
22 #include "qlegend_p.h"
22 #include "qlegend_p.h"
23 #include "qseries.h"
23 #include "qabstractseries.h"
24 #include "qseries_p.h"
24 #include "qabstractseries_p.h"
25 #include "qchart_p.h"
25 #include "qchart_p.h"
26
26
27 #include "legendmarker_p.h"
27 #include "legendmarker_p.h"
@@ -56,7 +56,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
56
56
57 \mainclass
57 \mainclass
58
58
59 \sa QChart, QSeries
59 \sa QChart, QAbstractSeries
60 */
60 */
61
61
62 /*!
62 /*!
@@ -91,8 +91,8 d_ptr(new QLegendPrivate(chart->d_ptr->m_presenter,this))
91 setFlags(QGraphicsItem::ItemClipsChildrenToShape);
91 setFlags(QGraphicsItem::ItemClipsChildrenToShape);
92 setEnabled(false); // By default legend is disabled
92 setEnabled(false); // By default legend is disabled
93 setVisible(false);
93 setVisible(false);
94 QObject::connect(chart->d_ptr->m_dataset,SIGNAL(seriesAdded(QSeries*,Domain*)),d_ptr.data(),SLOT(handleSeriesAdded(QSeries*,Domain*)));
94 QObject::connect(chart->d_ptr->m_dataset,SIGNAL(seriesAdded(QAbstractSeries *, Domain *)),d_ptr.data(),SLOT(handleSeriesAdded(QAbstractSeries *,Domain*)));
95 QObject::connect(chart->d_ptr->m_dataset,SIGNAL(seriesRemoved(QSeries*)),d_ptr.data(),SLOT(handleSeriesRemoved(QSeries*)));
95 QObject::connect(chart->d_ptr->m_dataset,SIGNAL(seriesRemoved(QAbstractSeries *)),d_ptr.data(),SLOT(handleSeriesRemoved(QAbstractSeries *)));
96 }
96 }
97
97
98 QLegend::~QLegend()
98 QLegend::~QLegend()
@@ -396,7 +396,7 void QLegendPrivate::updateLayout()
396 m_presenter->updateLayout();
396 m_presenter->updateLayout();
397 }
397 }
398
398
399 void QLegendPrivate::handleSeriesAdded(QSeries *series, Domain *domain)
399 void QLegendPrivate::handleSeriesAdded(QAbstractSeries *series, Domain *domain)
400 {
400 {
401 Q_UNUSED(domain)
401 Q_UNUSED(domain)
402
402
@@ -404,7 +404,7 void QLegendPrivate::handleSeriesAdded(QSeries *series, Domain *domain)
404 foreach(LegendMarker* marker , markers)
404 foreach(LegendMarker* marker , markers)
405 m_markers->addToGroup(marker);
405 m_markers->addToGroup(marker);
406
406
407 if(series->type()==QSeries::SeriesTypePie)
407 if(series->type() == QAbstractSeries::SeriesTypePie)
408 {
408 {
409 QPieSeries *pieSeries = static_cast<QPieSeries *>(series);
409 QPieSeries *pieSeries = static_cast<QPieSeries *>(series);
410 QObject::connect(pieSeries,SIGNAL(added(QList<QPieSlice*>)),this,SLOT(handleUpdateSeries()));
410 QObject::connect(pieSeries,SIGNAL(added(QList<QPieSlice*>)),this,SLOT(handleUpdateSeries()));
@@ -414,7 +414,7 void QLegendPrivate::handleSeriesAdded(QSeries *series, Domain *domain)
414 updateLayout();
414 updateLayout();
415 }
415 }
416
416
417 void QLegendPrivate::handleSeriesRemoved(QSeries *series)
417 void QLegendPrivate::handleSeriesRemoved(QAbstractSeries *series)
418 {
418 {
419
419
420 QList<QGraphicsItem *> items = m_markers->childItems();
420 QList<QGraphicsItem *> items = m_markers->childItems();
@@ -426,7 +426,7 void QLegendPrivate::handleSeriesRemoved(QSeries *series)
426 }
426 }
427 }
427 }
428
428
429 if(series->type()==QSeries::SeriesTypePie)
429 if(series->type() == QAbstractSeries::SeriesTypePie)
430 {
430 {
431 QPieSeries *pieSeries = static_cast<QPieSeries *>(series);
431 QPieSeries *pieSeries = static_cast<QPieSeries *>(series);
432 QObject::disconnect(pieSeries,SIGNAL(added(QList<QPieSlice*>)),this,SLOT(handleUpdateSeries()));
432 QObject::disconnect(pieSeries,SIGNAL(added(QList<QPieSlice*>)),this,SLOT(handleUpdateSeries()));
@@ -439,7 +439,7 void QLegendPrivate::handleSeriesRemoved(QSeries *series)
439 void QLegendPrivate::handleUpdateSeries()
439 void QLegendPrivate::handleUpdateSeries()
440 {
440 {
441 //TODO: reimplement to be optimal
441 //TODO: reimplement to be optimal
442 QSeries* series = qobject_cast<QSeries *> (sender());
442 QAbstractSeries* series = qobject_cast<QAbstractSeries *> (sender());
443 Q_ASSERT(series);
443 Q_ASSERT(series);
444 handleSeriesRemoved(series);
444 handleSeriesRemoved(series);
445 handleSeriesAdded(series,0);
445 handleSeriesAdded(series,0);
@@ -37,8 +37,6 class QBarSeries;
37 class QPieSeries;
37 class QPieSeries;
38 class QAreaSeries;
38 class QAreaSeries;
39 class LegendScrollButton;
39 class LegendScrollButton;
40 class QSeries;
41
42 class QChart;
40 class QChart;
43 class QLegendPrivate;
41 class QLegendPrivate;
44
42
@@ -35,6 +35,7
35 QTCOMMERCIALCHART_BEGIN_NAMESPACE
35 QTCOMMERCIALCHART_BEGIN_NAMESPACE
36
36
37 class ChartPresenter;
37 class ChartPresenter;
38 class QAbstractSeries;
38
39
39 class QLegendPrivate : public QObject
40 class QLegendPrivate : public QObject
40 {
41 {
@@ -47,8 +48,8 public:
47 void updateLayout();
48 void updateLayout();
48
49
49 public Q_SLOTS:
50 public Q_SLOTS:
50 void handleSeriesAdded(QSeries *series, Domain *domain);
51 void handleSeriesAdded(QAbstractSeries *series, Domain *domain);
51 void handleSeriesRemoved(QSeries *series);
52 void handleSeriesRemoved(QAbstractSeries *series);
52 void handleUpdateSeries(); //TODO remove this function
53 void handleUpdateSeries(); //TODO remove this function
53
54
54 private:
55 private:
@@ -51,7 +51,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
51 /*!
51 /*!
52 \fn virtual QSeriesType QLineSeries::type() const
52 \fn virtual QSeriesType QLineSeries::type() const
53 \brief Returns type of series.
53 \brief Returns type of series.
54 \sa QSeries, QSeriesType
54 \sa QAbstractSeries, QSeriesType
55 */
55 */
56
56
57 /*!
57 /*!
@@ -78,9 +78,9 QLineSeries::~QLineSeries()
78 {
78 {
79 }
79 }
80
80
81 QSeries::QSeriesType QLineSeries::type() const
81 QAbstractSeries::QSeriesType QLineSeries::type() const
82 {
82 {
83 return QSeries::SeriesTypeLine;
83 return QAbstractSeries::SeriesTypeLine;
84 }
84 }
85
85
86 /*
86 /*
@@ -35,7 +35,7 public:
35 explicit QLineSeries(QObject *parent = 0);
35 explicit QLineSeries(QObject *parent = 0);
36 ~QLineSeries();
36 ~QLineSeries();
37
37
38 QSeries::QSeriesType type() const;
38 QAbstractSeries::QSeriesType type() const;
39
39
40 protected:
40 protected:
41 QLineSeries(QLineSeriesPrivate &d,QObject *parent = 0);
41 QLineSeries(QLineSeriesPrivate &d,QObject *parent = 0);
@@ -112,7 +112,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
112 Constructs a series object which is a child of \a parent.
112 Constructs a series object which is a child of \a parent.
113 */
113 */
114 QPieSeries::QPieSeries(QObject *parent) :
114 QPieSeries::QPieSeries(QObject *parent) :
115 QSeries(*new QPieSeriesPrivate(this),parent)
115 QAbstractSeries(*new QPieSeriesPrivate(this),parent)
116 {
116 {
117
117
118 }
118 }
@@ -128,9 +128,9 QPieSeries::~QPieSeries()
128 /*!
128 /*!
129 Returns QChartSeries::SeriesTypePie.
129 Returns QChartSeries::SeriesTypePie.
130 */
130 */
131 QSeries::QSeriesType QPieSeries::type() const
131 QAbstractSeries::QSeriesType QPieSeries::type() const
132 {
132 {
133 return QSeries::SeriesTypePie;
133 return QAbstractSeries::SeriesTypePie;
134 }
134 }
135
135
136 /*!
136 /*!
@@ -521,8 +521,8 void QPieSeries::setModelMapping(int modelValuesLine, int modelLabelsLine, Qt::O
521 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
521 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
522
522
523
523
524 QPieSeriesPrivate::QPieSeriesPrivate(QPieSeries *parent)
524 QPieSeriesPrivate::QPieSeriesPrivate(QPieSeries *parent) :
525 :QSeriesPrivate(parent),
525 QAbstractSeriesPrivate(parent),
526 m_pieRelativeHorPos(0.5),
526 m_pieRelativeHorPos(0.5),
527 m_pieRelativeVerPos(0.5),
527 m_pieRelativeVerPos(0.5),
528 m_pieRelativeSize(0.7),
528 m_pieRelativeSize(0.7),
@@ -21,13 +21,13
21 #ifndef PIESERIES_H
21 #ifndef PIESERIES_H
22 #define PIESERIES_H
22 #define PIESERIES_H
23
23
24 #include <qseries.h>
24 #include <qabstractseries.h>
25
25
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27 class QPieSeriesPrivate;
27 class QPieSeriesPrivate;
28 class QPieSlice;
28 class QPieSlice;
29
29
30 class QTCOMMERCIALCHART_EXPORT QPieSeries : public QSeries
30 class QTCOMMERCIALCHART_EXPORT QPieSeries : public QAbstractSeries
31 {
31 {
32 Q_OBJECT
32 Q_OBJECT
33 Q_PROPERTY(qreal horizontalPosition READ horizontalPosition WRITE setHorizontalPosition)
33 Q_PROPERTY(qreal horizontalPosition READ horizontalPosition WRITE setHorizontalPosition)
@@ -22,13 +22,13
22 #define QPIESERIES_P_H
22 #define QPIESERIES_P_H
23
23
24 #include "qpieseries.h"
24 #include "qpieseries.h"
25 #include "qseries_p.h"
25 #include "qabstractseries_p.h"
26
26
27 class QModelIndex;
27 class QModelIndex;
28
28
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30
30
31 class QPieSeriesPrivate : public QSeriesPrivate
31 class QPieSeriesPrivate : public QAbstractSeriesPrivate
32 {
32 {
33 Q_OBJECT
33 Q_OBJECT
34
34
@@ -18,13 +18,13
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 #include "qseries.h"
21 #include "qabstractseries.h"
22 #include "qseries_p.h"
22 #include "qabstractseries_p.h"
23
23
24 QTCOMMERCIALCHART_BEGIN_NAMESPACE
24 QTCOMMERCIALCHART_BEGIN_NAMESPACE
25
25
26 /*!
26 /*!
27 \class QSeries
27 \class QAbstractSeries
28 \brief Base class for all QtCommercial Chart series.
28 \brief Base class for all QtCommercial Chart series.
29 \mainclass
29 \mainclass
30
30
@@ -34,7 +34,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
34 */
34 */
35
35
36 /*!
36 /*!
37 \enum QSeries::QSeriesType
37 \enum QAbstractSeries::QSeriesType
38
38
39 The type of the series object.
39 The type of the series object.
40
40
@@ -49,12 +49,12 QTCOMMERCIALCHART_BEGIN_NAMESPACE
49 */
49 */
50
50
51 /*!
51 /*!
52 \fn QSeriesType QSeries::type() const
52 \fn QSeriesType QAbstractSeries::type() const
53 \brief The type of the series.
53 \brief The type of the series.
54 */
54 */
55
55
56 /*!
56 /*!
57 \fn bool QSeries::setModel(QAbstractItemModel *model)
57 \fn bool QAbstractSeries::setModel(QAbstractItemModel *model)
58 \brief Use the \a model to provide data for the series. The model overrides possible user data
58 \brief Use the \a model to provide data for the series. The model overrides possible user data
59 set with QChartSeries type specific data setters. For example if you call both
59 set with QChartSeries type specific data setters. For example if you call both
60 QScatterSeries::addData() and QScatterSeries::setModel, only the data provided by the model is
60 QScatterSeries::addData() and QScatterSeries::setModel, only the data provided by the model is
@@ -62,12 +62,12 QTCOMMERCIALCHART_BEGIN_NAMESPACE
62 */
62 */
63
63
64 /*!
64 /*!
65 \property QSeries::name
65 \property QAbstractSeries::name
66 \brief name of the series property
66 \brief name of the series property
67 */
67 */
68
68
69 /*!
69 /*!
70 \fn void QSeries::setName(const QString& name)
70 \fn void QAbstractSeries::setName(const QString& name)
71 \brief Sets a \a name for the series.
71 \brief Sets a \a name for the series.
72
72
73 The name of a series is shown in the legend for QXYSeries.
73 The name of a series is shown in the legend for QXYSeries.
@@ -80,7 +80,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
80 \internal
80 \internal
81 \brief Constructs ChartSeries object with \a parent.
81 \brief Constructs ChartSeries object with \a parent.
82 */
82 */
83 QSeries::QSeries(QSeriesPrivate &d, QObject *parent) :
83 QAbstractSeries::QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent) :
84 QObject(parent),
84 QObject(parent),
85 d_ptr(&d)
85 d_ptr(&d)
86 {
86 {
@@ -89,19 +89,19 QSeries::QSeries(QSeriesPrivate &d, QObject *parent) :
89 /*!
89 /*!
90 \brief Virtual destructor for the chart series.
90 \brief Virtual destructor for the chart series.
91 */
91 */
92 QSeries::~QSeries()
92 QAbstractSeries::~QAbstractSeries()
93 {
93 {
94 }
94 }
95
95
96 /*!
96 /*!
97 \brief Returns the pointer to the model that is used as the series data source
97 \brief Returns the pointer to the model that is used as the series data source
98 */
98 */
99 QAbstractItemModel* QSeries::model() const
99 QAbstractItemModel* QAbstractSeries::model() const
100 {
100 {
101 return d_ptr->m_model;
101 return d_ptr->m_model;
102 }
102 }
103
103
104 void QSeries::setName(const QString& name)
104 void QAbstractSeries::setName(const QString& name)
105 {
105 {
106 d_ptr->m_name = name;
106 d_ptr->m_name = name;
107 }
107 }
@@ -110,23 +110,23 void QSeries::setName(const QString& name)
110 \brief Returns the name of the series.
110 \brief Returns the name of the series.
111 \sa setName()
111 \sa setName()
112 */
112 */
113 QString QSeries::name() const
113 QString QAbstractSeries::name() const
114 {
114 {
115 return d_ptr->m_name;
115 return d_ptr->m_name;
116 }
116 }
117
117
118 ///////////////////////////////////////////////////////////////////////////////////////////////////
118 ///////////////////////////////////////////////////////////////////////////////////////////////////
119
119
120 QSeriesPrivate::QSeriesPrivate(QSeries* q): q_ptr(q),m_model(0)
120 QAbstractSeriesPrivate::QAbstractSeriesPrivate(QAbstractSeries* q): q_ptr(q),m_model(0)
121 {
121 {
122 }
122 }
123
123
124 QSeriesPrivate::~QSeriesPrivate()
124 QAbstractSeriesPrivate::~QAbstractSeriesPrivate()
125 {
125 {
126 }
126 }
127
127
128 #include "moc_qseries.cpp"
128 #include "moc_qabstractseries.cpp"
129 #include "moc_qseries_p.cpp"
129 #include "moc_qabstractseries_p.cpp"
130
130
131 QTCOMMERCIALCHART_END_NAMESPACE
131 QTCOMMERCIALCHART_END_NAMESPACE
132
132
@@ -18,8 +18,8
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 #ifndef QSERIES_H
21 #ifndef QABSTRACTSERIES_H
22 #define QSERIES_H
22 #define QABSTRACTSERIES_H
23
23
24 #include <qchartglobal.h>
24 #include <qchartglobal.h>
25 #include <QObject>
25 #include <QObject>
@@ -29,9 +29,9 class QAbstractItemModel;
29
29
30 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30 QTCOMMERCIALCHART_BEGIN_NAMESPACE
31
31
32 class QSeriesPrivate;
32 class QAbstractSeriesPrivate;
33
33
34 class QTCOMMERCIALCHART_EXPORT QSeries : public QObject
34 class QTCOMMERCIALCHART_EXPORT QAbstractSeries : public QObject
35 {
35 {
36 Q_OBJECT
36 Q_OBJECT
37 Q_PROPERTY(QString name READ name WRITE setName)
37 Q_PROPERTY(QString name READ name WRITE setName)
@@ -50,10 +50,10 public:
50 };
50 };
51
51
52 protected:
52 protected:
53 QSeries(QSeriesPrivate &d, QObject *parent = 0);
53 QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent = 0);
54
54
55 public:
55 public:
56 ~QSeries();
56 ~QAbstractSeries();
57 virtual QSeriesType type() const = 0;
57 virtual QSeriesType type() const = 0;
58 virtual bool setModel(QAbstractItemModel* model) = 0;
58 virtual bool setModel(QAbstractItemModel* model) = 0;
59 QAbstractItemModel* model() const;
59 QAbstractItemModel* model() const;
@@ -61,7 +61,7 public:
61 QString name() const;
61 QString name() const;
62
62
63 protected:
63 protected:
64 QScopedPointer<QSeriesPrivate> d_ptr;
64 QScopedPointer<QAbstractSeriesPrivate> d_ptr;
65 friend class ChartDataSet;
65 friend class ChartDataSet;
66 friend class ChartPresenter;
66 friend class ChartPresenter;
67 friend class QLegendPrivate;
67 friend class QLegendPrivate;
@@ -27,10 +27,10
27 //
27 //
28 // We mean it.
28 // We mean it.
29
29
30 #ifndef QSERIES_P_H
30 #ifndef QABSTRACTSERIES_P_H
31 #define QSERIES_P_H
31 #define QABSTRACTSERIES_P_H
32
32
33 #include "qseries.h"
33 #include "qabstractseries.h"
34
34
35 class QAbstractItemModel;
35 class QAbstractItemModel;
36
36
@@ -42,23 +42,23 class Chart;
42 class LegendMarker;
42 class LegendMarker;
43 class QLegend;
43 class QLegend;
44
44
45 class QSeriesPrivate : public QObject
45 class QAbstractSeriesPrivate : public QObject
46 {
46 {
47 Q_OBJECT
47 Q_OBJECT
48 public:
48 public:
49 QSeriesPrivate(QSeries *q);
49 QAbstractSeriesPrivate(QAbstractSeries *q);
50 ~QSeriesPrivate();
50 ~QAbstractSeriesPrivate();
51
51
52 virtual void scaleDomain(Domain& domain) = 0;
52 virtual void scaleDomain(Domain& domain) = 0;
53 virtual Chart* createGraphics(ChartPresenter* presenter) = 0;
53 virtual Chart* createGraphics(ChartPresenter* presenter) = 0;
54 virtual QList<LegendMarker*> createLegendMarker(QLegend* legend) = 0;
54 virtual QList<LegendMarker*> createLegendMarker(QLegend* legend) = 0;
55
55
56 protected:
56 protected:
57 QSeries *q_ptr;
57 QAbstractSeries *q_ptr;
58 QAbstractItemModel *m_model;
58 QAbstractItemModel *m_model;
59 QString m_name;
59 QString m_name;
60
60
61 friend class QSeries;
61 friend class QAbstractSeries;
62 };
62 };
63
63
64 QTCOMMERCIALCHART_END_NAMESPACE
64 QTCOMMERCIALCHART_END_NAMESPACE
@@ -91,7 +91,7 QChart::~QChart()
91 If auto scaling is enabled, re-scales the axes the series is bound to (both the x axis and
91 If auto scaling is enabled, re-scales the axes the series is bound to (both the x axis and
92 the y axis).
92 the y axis).
93 */
93 */
94 void QChart::addSeries(QSeries* series, QChartAxis* axisY)
94 void QChart::addSeries(QAbstractSeries *series, QChartAxis *axisY)
95 {
95 {
96 Q_ASSERT(series);
96 Q_ASSERT(series);
97 d_ptr->m_dataset->addSeries(series, axisY);
97 d_ptr->m_dataset->addSeries(series, axisY);
@@ -103,7 +103,7 void QChart::addSeries(QSeries* series, QChartAxis* axisY)
103 It does not delete the pointed QChartSeries data object
103 It does not delete the pointed QChartSeries data object
104 \sa addSeries(), removeAllSeries()
104 \sa addSeries(), removeAllSeries()
105 */
105 */
106 void QChart::removeSeries(QSeries* series)
106 void QChart::removeSeries(QAbstractSeries *series)
107 {
107 {
108 Q_ASSERT(series);
108 Q_ASSERT(series);
109 d_ptr->m_dataset->removeSeries(series);
109 d_ptr->m_dataset->removeSeries(series);
@@ -282,7 +282,7 QChartAxis* QChart::axisX() const
282 Returns the pointer to the y axis object of the \a series
282 Returns the pointer to the y axis object of the \a series
283 If no \a series is provided then default Y axis of the chart is returned.
283 If no \a series is provided then default Y axis of the chart is returned.
284 */
284 */
285 QChartAxis* QChart::axisY(QSeries* series) const
285 QChartAxis* QChart::axisY(QAbstractSeries *series) const
286 {
286 {
287 return d_ptr->m_dataset->axisY(series);
287 return d_ptr->m_dataset->axisY(series);
288 }
288 }
@@ -401,8 +401,8 QChartPrivate::~QChartPrivate()
401 void QChartPrivate::createConnections()
401 void QChartPrivate::createConnections()
402 {
402 {
403
403
404 QObject::connect(m_dataset,SIGNAL(seriesAdded(QSeries*,Domain*)),m_presenter,SLOT(handleSeriesAdded(QSeries*,Domain*)));
404 QObject::connect(m_dataset,SIGNAL(seriesAdded(QAbstractSeries *, Domain *)),m_presenter,SLOT(handleSeriesAdded(QAbstractSeries *, Domain *)));
405 QObject::connect(m_dataset,SIGNAL(seriesRemoved(QSeries*)),m_presenter,SLOT(handleSeriesRemoved(QSeries*)));
405 QObject::connect(m_dataset,SIGNAL(seriesRemoved(QAbstractSeries *)),m_presenter,SLOT(handleSeriesRemoved(QAbstractSeries *)));
406 QObject::connect(m_dataset,SIGNAL(axisAdded(QChartAxis*,Domain*)),m_presenter,SLOT(handleAxisAdded(QChartAxis*,Domain*)));
406 QObject::connect(m_dataset,SIGNAL(axisAdded(QChartAxis*,Domain*)),m_presenter,SLOT(handleAxisAdded(QChartAxis*,Domain*)));
407 QObject::connect(m_dataset,SIGNAL(axisRemoved(QChartAxis*)),m_presenter,SLOT(handleAxisRemoved(QChartAxis*)));
407 QObject::connect(m_dataset,SIGNAL(axisRemoved(QChartAxis*)),m_presenter,SLOT(handleAxisRemoved(QChartAxis*)));
408 }
408 }
@@ -21,7 +21,7
21 #ifndef QCHART_H
21 #ifndef QCHART_H
22 #define QCHART_H
22 #define QCHART_H
23
23
24 #include <QSeries>
24 #include <QAbstractSeries>
25 #include <QLegend>
25 #include <QLegend>
26 #include <QGraphicsWidget>
26 #include <QGraphicsWidget>
27
27
@@ -29,7 +29,7 class QGraphicsSceneResizeEvent;
29
29
30 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30 QTCOMMERCIALCHART_BEGIN_NAMESPACE
31
31
32 class QSeries;
32 class QAbstractSeries;
33 class QChartAxis;
33 class QChartAxis;
34 class QLegend;
34 class QLegend;
35 struct QChartPrivate;
35 struct QChartPrivate;
@@ -63,8 +63,8 public:
63 explicit QChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
63 explicit QChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
64 ~QChart();
64 ~QChart();
65
65
66 void addSeries(QSeries *series, QChartAxis *axisY = 0);
66 void addSeries(QAbstractSeries *series, QChartAxis *axisY = 0);
67 void removeSeries(QSeries *series);
67 void removeSeries(QAbstractSeries *series);
68 void removeAllSeries();
68 void removeAllSeries();
69
69
70 void setTheme(QChart::ChartTheme theme);
70 void setTheme(QChart::ChartTheme theme);
@@ -97,7 +97,7 public:
97 void scrollDown();
97 void scrollDown();
98
98
99 QChartAxis* axisX() const;
99 QChartAxis* axisX() const;
100 QChartAxis* axisY(QSeries* series = 0) const;
100 QChartAxis* axisY(QAbstractSeries* series = 0) const;
101
101
102 QLegend* legend() const;
102 QLegend* legend() const;
103 QRectF margins() const;
103 QRectF margins() const;
@@ -22,7 +22,7
22 #define QCHARTVIEW_H
22 #define QCHARTVIEW_H
23
23
24 #include <QChartAxis>
24 #include <QChartAxis>
25 #include <QSeries>
25 #include <QAbstractSeries>
26 #include <QChart>
26 #include <QChart>
27 #include <QGraphicsView>
27 #include <QGraphicsView>
28
28
@@ -58,7 +58,7
58 /*!
58 /*!
59 \fn QChartSeriesType QScatterSeries::type() const
59 \fn QChartSeriesType QScatterSeries::type() const
60 \brief Returns QChartSeries::SeriesTypeScatter.
60 \brief Returns QChartSeries::SeriesTypeScatter.
61 \sa QSeries, QSeriesType
61 \sa QAbstractSeries, QSeriesType
62 */
62 */
63
63
64 QTCOMMERCIALCHART_BEGIN_NAMESPACE
64 QTCOMMERCIALCHART_BEGIN_NAMESPACE
@@ -77,9 +77,9 QScatterSeries::~QScatterSeries()
77 {
77 {
78 }
78 }
79
79
80 QSeries::QSeriesType QScatterSeries::type() const
80 QAbstractSeries::QSeriesType QScatterSeries::type() const
81 {
81 {
82 return QSeries::SeriesTypeScatter;
82 return QAbstractSeries::SeriesTypeScatter;
83 }
83 }
84
84
85 /*!
85 /*!
@@ -41,7 +41,7 public:
41 explicit QScatterSeries(QObject *parent = 0);
41 explicit QScatterSeries(QObject *parent = 0);
42 ~QScatterSeries();
42 ~QScatterSeries();
43
43
44 QSeries::QSeriesType type() const;
44 QAbstractSeries::QSeriesType type() const;
45
45
46 MarkerShape shape() const;
46 MarkerShape shape() const;
47 void setShape(MarkerShape shape);
47 void setShape(MarkerShape shape);
@@ -55,9 +55,9 QSplineSeries::QSplineSeries(QObject *parent) :
55 {
55 {
56 }
56 }
57
57
58 QSeries::QSeriesType QSplineSeries::type() const
58 QAbstractSeries::QSeriesType QSplineSeries::type() const
59 {
59 {
60 return QSeries::SeriesTypeSpline;
60 return QAbstractSeries::SeriesTypeSpline;
61 }
61 }
62
62
63 QPointF QSplineSeries::controlPoint(int index) const
63 QPointF QSplineSeries::controlPoint(int index) const
@@ -37,7 +37,7 class QTCOMMERCIALCHART_EXPORT QSplineSeries : public QLineSeries
37 public:
37 public:
38
38
39 explicit QSplineSeries(QObject *parent = 0);
39 explicit QSplineSeries(QObject *parent = 0);
40 QSeries::QSeriesType type() const;
40 QAbstractSeries::QSeriesType type() const;
41
41
42 QPointF controlPoint(int index) const;
42 QPointF controlPoint(int index) const;
43 void setModelMappingRange(int first, int count);
43 void setModelMappingRange(int first, int count);
@@ -14,7 +14,7 SOURCES += \
14 $$PWD/domain.cpp \
14 $$PWD/domain.cpp \
15 $$PWD/qchart.cpp \
15 $$PWD/qchart.cpp \
16 $$PWD/qchartview.cpp \
16 $$PWD/qchartview.cpp \
17 $$PWD/qseries.cpp \
17 $$PWD/qabstractseries.cpp \
18 $$PWD/chartbackground.cpp \
18 $$PWD/chartbackground.cpp \
19 $$PWD/chart.cpp \
19 $$PWD/chart.cpp \
20 $$PWD/scroller.cpp
20 $$PWD/scroller.cpp
@@ -30,11 +30,11 PRIVATE_HEADERS += \
30 $$PWD/qchart_p.h \
30 $$PWD/qchart_p.h \
31 $$PWD/qchartview_p.h \
31 $$PWD/qchartview_p.h \
32 $$PWD/scroller_p.h \
32 $$PWD/scroller_p.h \
33 $$PWD/qseries_p.h
33 $$PWD/qabstractseries_p.h
34 PUBLIC_HEADERS += \
34 PUBLIC_HEADERS += \
35 $$PWD/qchart.h \
35 $$PWD/qchart.h \
36 $$PWD/qchartglobal.h \
36 $$PWD/qchartglobal.h \
37 $$PWD/qseries.h \
37 $$PWD/qabstractseries.h \
38 $$PWD/qchartview.h
38 $$PWD/qchartview.h
39
39
40 include(animations/animations.pri)
40 include(animations/animations.pri)
@@ -94,7 +94,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
94 Constructs empty series object which is a child of \a parent.
94 Constructs empty series object which is a child of \a parent.
95 When series object is added to QChartView or QChart instance ownerships is transferred.
95 When series object is added to QChartView or QChart instance ownerships is transferred.
96 */
96 */
97 QXYSeries::QXYSeries(QXYSeriesPrivate &d,QObject *parent):QSeries(d,parent)
97 QXYSeries::QXYSeries(QXYSeriesPrivate &d,QObject *parent) : QAbstractSeries(d, parent)
98 {
98 {
99
99
100 }
100 }
@@ -622,7 +622,7 int QXYSeries::mapCount() const
622
622
623 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
623 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
624
624
625 QXYSeriesPrivate::QXYSeriesPrivate(QXYSeries *q): QSeriesPrivate(q),
625 QXYSeriesPrivate::QXYSeriesPrivate(QXYSeries *q) : QAbstractSeriesPrivate(q),
626 m_mapX(-1),
626 m_mapX(-1),
627 m_mapY(-1),
627 m_mapY(-1),
628 m_mapFirst(0),
628 m_mapFirst(0),
@@ -631,7 +631,6 m_mapLimited(false),
631 m_mapOrientation( Qt::Vertical),
631 m_mapOrientation( Qt::Vertical),
632 m_pointsVisible(false)
632 m_pointsVisible(false)
633 {
633 {
634
635 }
634 }
636
635
637 void QXYSeriesPrivate::scaleDomain(Domain& domain)
636 void QXYSeriesPrivate::scaleDomain(Domain& domain)
@@ -22,7 +22,7
22 #define QXYSERIES_H
22 #define QXYSERIES_H
23
23
24 #include <qchartglobal.h>
24 #include <qchartglobal.h>
25 #include <qseries.h>
25 #include <qabstractseries.h>
26 #include <QPen>
26 #include <QPen>
27 #include <QBrush>
27 #include <QBrush>
28
28
@@ -32,7 +32,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
32
32
33 class QXYSeriesPrivate;
33 class QXYSeriesPrivate;
34
34
35 class QTCOMMERCIALCHART_EXPORT QXYSeries : public QSeries
35 class QTCOMMERCIALCHART_EXPORT QXYSeries : public QAbstractSeries
36 {
36 {
37 Q_OBJECT
37 Q_OBJECT
38 protected:
38 protected:
@@ -30,13 +30,13
30 #ifndef QXYSERIES_P_H
30 #ifndef QXYSERIES_P_H
31 #define QXYSERIES_P_H
31 #define QXYSERIES_P_H
32
32
33 #include "qseries_p.h"
33 #include "qabstractseries_p.h"
34
34
35 QTCOMMERCIALCHART_BEGIN_NAMESPACE
35 QTCOMMERCIALCHART_BEGIN_NAMESPACE
36
36
37 class QXYSeries;
37 class QXYSeries;
38
38
39 class QXYSeriesPrivate: public QSeriesPrivate
39 class QXYSeriesPrivate: public QAbstractSeriesPrivate
40 {
40 {
41 Q_OBJECT
41 Q_OBJECT
42
42
@@ -28,7 +28,7 QTCOMMERCIALCHART_USE_NAMESPACE
28
28
29 Q_DECLARE_METATYPE(Domain*)
29 Q_DECLARE_METATYPE(Domain *)
30 Q_DECLARE_METATYPE(QChartAxis*)
30 Q_DECLARE_METATYPE(QChartAxis *)
31 Q_DECLARE_METATYPE(QSeries*)
31 Q_DECLARE_METATYPE(QAbstractSeries *)
32 Q_DECLARE_METATYPE(QLineSeries*)
32 Q_DECLARE_METATYPE(QLineSeries *)
33
33
34 class tst_ChartDataSet: public QObject {
34 class tst_ChartDataSet: public QObject {
@@ -138,8 +138,8 void tst_ChartDataSet::addSeries()
138
138
139 QSignalSpy spy0(&dataSet, SIGNAL(axisAdded(QChartAxis*,Domain*)));
139 QSignalSpy spy0(&dataSet, SIGNAL(axisAdded(QChartAxis*,Domain*)));
140 QSignalSpy spy1(&dataSet, SIGNAL(axisRemoved(QChartAxis*)));
140 QSignalSpy spy1(&dataSet, SIGNAL(axisRemoved(QChartAxis*)));
141 QSignalSpy spy2(&dataSet, SIGNAL(seriesAdded(QSeries*,Domain*)));
141 QSignalSpy spy2(&dataSet, SIGNAL(seriesAdded(QAbstractSeries *,Domain*)));
142 QSignalSpy spy3(&dataSet, SIGNAL(seriesRemoved(QSeries*)));
142 QSignalSpy spy3(&dataSet, SIGNAL(seriesRemoved(QAbstractSeries *)));
143
143
144 dataSet.addSeries(series0,axis0);
144 dataSet.addSeries(series0,axis0);
145 dataSet.addSeries(series1,axis1);
145 dataSet.addSeries(series1,axis1);
@@ -182,8 +182,8 void tst_ChartDataSet::removeSeries()
182
182
183 QSignalSpy spy0(&dataSet, SIGNAL(axisAdded(QChartAxis*,Domain*)));
183 QSignalSpy spy0(&dataSet, SIGNAL(axisAdded(QChartAxis *, Domain *)));
184 QSignalSpy spy1(&dataSet, SIGNAL(axisRemoved(QChartAxis*)));
184 QSignalSpy spy1(&dataSet, SIGNAL(axisRemoved(QChartAxis *)));
185 QSignalSpy spy2(&dataSet, SIGNAL(seriesAdded(QSeries*,Domain*)));
185 QSignalSpy spy2(&dataSet, SIGNAL(seriesAdded(QAbstractSeries *, Domain *)));
186 QSignalSpy spy3(&dataSet, SIGNAL(seriesRemoved(QSeries*)));
186 QSignalSpy spy3(&dataSet, SIGNAL(seriesRemoved(QAbstractSeries *)));
187
187
188 dataSet.removeSeries(series0);
188 dataSet.removeSeries(series0);
189 dataSet.removeSeries(series1);
189 dataSet.removeSeries(series1);
@@ -219,8 +219,8 void tst_ChartDataSet::removeAllSeries()
219
219
220 QSignalSpy spy0(&dataSet, SIGNAL(axisAdded(QChartAxis*,Domain*)));
220 QSignalSpy spy0(&dataSet, SIGNAL(axisAdded(QChartAxis *, Domain *)));
221 QSignalSpy spy1(&dataSet, SIGNAL(axisRemoved(QChartAxis*)));
221 QSignalSpy spy1(&dataSet, SIGNAL(axisRemoved(QChartAxis *)));
222 QSignalSpy spy2(&dataSet, SIGNAL(seriesAdded(QSeries*,Domain*)));
222 QSignalSpy spy2(&dataSet, SIGNAL(seriesAdded(QAbstractSeries *, Domain *)));
223 QSignalSpy spy3(&dataSet, SIGNAL(seriesRemoved(QSeries*)));
223 QSignalSpy spy3(&dataSet, SIGNAL(seriesRemoved(QAbstractSeries *)));
224
224
225 dataSet.removeAllSeries();
225 dataSet.removeAllSeries();
226
226
@@ -295,8 +295,8 void tst_ChartDataSet::seriesCount()
295
295
296 QSignalSpy spy0(&dataSet, SIGNAL(axisAdded(QChartAxis*,Domain*)));
296 QSignalSpy spy0(&dataSet, SIGNAL(axisAdded(QChartAxis *, Domain *)));
297 QSignalSpy spy1(&dataSet, SIGNAL(axisRemoved(QChartAxis*)));
297 QSignalSpy spy1(&dataSet, SIGNAL(axisRemoved(QChartAxis *)));
298 QSignalSpy spy2(&dataSet, SIGNAL(seriesAdded(QSeries*,Domain*)));
298 QSignalSpy spy2(&dataSet, SIGNAL(seriesAdded(QAbstractSeries *, Domain *)));
299 QSignalSpy spy3(&dataSet, SIGNAL(seriesRemoved(QSeries*)));
299 QSignalSpy spy3(&dataSet, SIGNAL(seriesRemoved(QAbstractSeries *)));
300
300
301 QCOMPARE(dataSet.seriesCount(series0->type()),3);
301 QCOMPARE(dataSet.seriesCount(series0->type()),3);
302 QCOMPARE(spy0.count(), 0);
302 QCOMPARE(spy0.count(), 0);
@@ -424,8 +424,8 void tst_ChartDataSet::domain()
424
424
425 QSignalSpy spy0(&dataSet, SIGNAL(axisAdded(QChartAxis*,Domain*)));
425 QSignalSpy spy0(&dataSet, SIGNAL(axisAdded(QChartAxis *, Domain *)));
426 QSignalSpy spy1(&dataSet, SIGNAL(axisRemoved(QChartAxis*)));
426 QSignalSpy spy1(&dataSet, SIGNAL(axisRemoved(QChartAxis *)));
427 QSignalSpy spy2(&dataSet, SIGNAL(seriesAdded(QSeries*,Domain*)));
427 QSignalSpy spy2(&dataSet, SIGNAL(seriesAdded(QAbstractSeries *, Domain *)));
428 QSignalSpy spy3(&dataSet, SIGNAL(seriesRemoved(QSeries*)));
428 QSignalSpy spy3(&dataSet, SIGNAL(seriesRemoved(QAbstractSeries *)));
429
429
430 QVERIFY(dataSet.domain(axis0)==dataSet.domain(series0));
430 QVERIFY(dataSet.domain(axis0)==dataSet.domain(series0));
431 QVERIFY(dataSet.domain(axis1)==dataSet.domain(series1));
431 QVERIFY(dataSet.domain(axis1)==dataSet.domain(series1));
@@ -12,7 +12,7
12 QTCOMMERCIALCHART_USE_NAMESPACE
12 QTCOMMERCIALCHART_USE_NAMESPACE
13
13
14 Q_DECLARE_METATYPE(QChartAxis*)
14 Q_DECLARE_METATYPE(QChartAxis *)
15 Q_DECLARE_METATYPE(QSeries*)
15 Q_DECLARE_METATYPE(QAbstractSeries *)
16 Q_DECLARE_METATYPE(QChart::AnimationOption)
16 Q_DECLARE_METATYPE(QChart::AnimationOption)
17 Q_DECLARE_METATYPE(QBrush)
17 Q_DECLARE_METATYPE(QBrush)
18 Q_DECLARE_METATYPE(QPen)
18 Q_DECLARE_METATYPE(QPen)
@@ -156,17 +156,17 void tst_QChart::qchart()
156
156
157 void tst_QChart::addSeries_data()
157 void tst_QChart::addSeries_data()
158 {
158 {
159 QTest::addColumn<QSeries*>("series");
159 QTest::addColumn<QAbstractSeries *>("series");
160 QTest::addColumn<QChartAxis*>("axis");
160 QTest::addColumn<QChartAxis *>("axis");
161
161
162 QSeries* series0 = new QLineSeries(this);
162 QAbstractSeries* series0 = new QLineSeries(this);
163 QSeries* series1 = new QAreaSeries(static_cast<QLineSeries*>(series0));
163 QAbstractSeries* series1 = new QAreaSeries(static_cast<QLineSeries*>(series0));
164 QSeries* series2 = new QScatterSeries(this);
164 QAbstractSeries* series2 = new QScatterSeries(this);
165 QSeries* series3 = new QSplineSeries(this);
165 QAbstractSeries* series3 = new QSplineSeries(this);
166 QSeries* series4 = new QPieSeries(this);
166 QAbstractSeries* series4 = new QPieSeries(this);
167 QSeries* series5 = new QBarSeries(QBarCategories(),this);
167 QAbstractSeries* series5 = new QBarSeries(QBarCategories(),this);
168 QSeries* series6 = new QPercentBarSeries(QBarCategories(),this);
168 QAbstractSeries* series6 = new QPercentBarSeries(QBarCategories(),this);
169 QSeries* series7 = new QStackedBarSeries(QBarCategories(),this);
169 QAbstractSeries* series7 = new QStackedBarSeries(QBarCategories(),this);
170
170
171 QChartAxis* axis = new QChartAxis(this);
171 QChartAxis* axis = new QChartAxis(this);
172
172
@@ -191,7 +191,7 void tst_QChart::addSeries_data()
191
191
192 void tst_QChart::addSeries()
192 void tst_QChart::addSeries()
193 {
193 {
194 QFETCH(QSeries*, series);
194 QFETCH(QAbstractSeries *, series);
195 QFETCH(QChartAxis*, axis);
195 QFETCH(QChartAxis *, axis);
196 m_view->show();
196 m_view->show();
197 QTest::qWaitForWindowShown(m_view);
197 QTest::qWaitForWindowShown(m_view);
@@ -384,7 +384,7 void tst_QChart::removeSeries_data()
384
384
385 void tst_QChart::removeSeries()
385 void tst_QChart::removeSeries()
386 {
386 {
387 QFETCH(QSeries*, series);
387 QFETCH(QAbstractSeries *, series);
388 QFETCH(QChartAxis*, axis);
388 QFETCH(QChartAxis *, axis);
389 m_view->show();
389 m_view->show();
390 QTest::qWaitForWindowShown(m_view);
390 QTest::qWaitForWindowShown(m_view);
@@ -31,7 +31,6 class CustomTableModel;
31 class QTableView;
31 class QTableView;
32 class QRadioButton;
32 class QRadioButton;
33 class QSpinBox;
33 class QSpinBox;
34 //class QSeries;
35
34
36 class TableWidget : public QWidget
35 class TableWidget : public QWidget
37 {
36 {
General Comments 0
You need to be logged in to leave comments. Login now