##// END OF EJS Templates
Refactoring declarative xy series
Tero Ahola -
r793:dbc1daf2590a
parent child
Show More
@@ -10,7 +10,7 DeclarativeLineSeries::DeclarativeLineSeries(QObject *parent) :
10 {
10 {
11 }
11 }
12
12
13 void DeclarativeLineSeries::seriesComplete()
13 void DeclarativeLineSeries::componentComplete()
14 {
14 {
15 DeclarativeChart *declarativeChart = qobject_cast<DeclarativeChart *>(parent());
15 DeclarativeChart *declarativeChart = qobject_cast<DeclarativeChart *>(parent());
16
16
@@ -21,14 +21,9 void DeclarativeLineSeries::seriesComplete()
21 }
21 }
22 }
22 }
23
23
24 QObject *DeclarativeLineSeries::seriesObject()
25 {
26 return this;
27 }
28
29 QDeclarativeListProperty<DeclarativeXyPoint> DeclarativeLineSeries::points()
24 QDeclarativeListProperty<DeclarativeXyPoint> DeclarativeLineSeries::points()
30 {
25 {
31 return DeclarativeXySeries::points();
26 return QDeclarativeListProperty<DeclarativeXyPoint>(this, 0, &DeclarativeXySeries::appendPoints);
32 }
27 }
33
28
34 void DeclarativeLineSeries::appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list,
29 void DeclarativeLineSeries::appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list,
@@ -17,13 +17,10 public:
17 explicit DeclarativeLineSeries(QObject *parent = 0);
17 explicit DeclarativeLineSeries(QObject *parent = 0);
18
18
19 public:
19 public:
20 void seriesComplete();
20 void componentComplete();
21 QObject *seriesObject();
22
23 public:
24 QDeclarativeListProperty<DeclarativeXyPoint> points();
21 QDeclarativeListProperty<DeclarativeXyPoint> points();
25
22
26 public slots:
23 public Q_SLOTS:
27 static void appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list,
24 static void appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list,
28 DeclarativeXyPoint *element);
25 DeclarativeXyPoint *element);
29 };
26 };
@@ -10,7 +10,7 DeclarativeScatterSeries::DeclarativeScatterSeries(QObject *parent) :
10 {
10 {
11 }
11 }
12
12
13 void DeclarativeScatterSeries::seriesComplete()
13 void DeclarativeScatterSeries::componentComplete()
14 {
14 {
15 DeclarativeChart *declarativeChart = qobject_cast<DeclarativeChart *>(parent());
15 DeclarativeChart *declarativeChart = qobject_cast<DeclarativeChart *>(parent());
16
16
@@ -22,14 +22,9 void DeclarativeScatterSeries::seriesComplete()
22 }
22 }
23 }
23 }
24
24
25 QObject *DeclarativeScatterSeries::seriesObject()
26 {
27 return this;
28 }
29
30 QDeclarativeListProperty<DeclarativeXyPoint> DeclarativeScatterSeries::points()
25 QDeclarativeListProperty<DeclarativeXyPoint> DeclarativeScatterSeries::points()
31 {
26 {
32 return DeclarativeXySeries::points();
27 return QDeclarativeListProperty<DeclarativeXyPoint>(this, 0, &DeclarativeXySeries::appendPoints);
33 }
28 }
34
29
35 void DeclarativeScatterSeries::appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list,
30 void DeclarativeScatterSeries::appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list,
@@ -17,13 +17,10 public:
17 explicit DeclarativeScatterSeries(QObject *parent = 0);
17 explicit DeclarativeScatterSeries(QObject *parent = 0);
18
18
19 public:
19 public:
20 void seriesComplete();
20 void componentComplete();
21 QObject *seriesObject();
22
23 public:
24 QDeclarativeListProperty<DeclarativeXyPoint> points();
21 QDeclarativeListProperty<DeclarativeXyPoint> points();
25
22
26 public slots:
23 public Q_SLOTS:
27 static void appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list,
24 static void appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list,
28 DeclarativeXyPoint *element);
25 DeclarativeXyPoint *element);
29 };
26 };
@@ -9,7 +9,7 DeclarativeSplineSeries::DeclarativeSplineSeries(QObject *parent) :
9 {
9 {
10 }
10 }
11
11
12 void DeclarativeSplineSeries::seriesComplete()
12 void DeclarativeSplineSeries::componentComplete()
13 {
13 {
14 DeclarativeChart *declarativeChart = qobject_cast<DeclarativeChart *>(parent());
14 DeclarativeChart *declarativeChart = qobject_cast<DeclarativeChart *>(parent());
15
15
@@ -20,14 +20,9 void DeclarativeSplineSeries::seriesComplete()
20 }
20 }
21 }
21 }
22
22
23 QObject *DeclarativeSplineSeries::seriesObject()
24 {
25 return this;
26 }
27
28 QDeclarativeListProperty<DeclarativeXyPoint> DeclarativeSplineSeries::points()
23 QDeclarativeListProperty<DeclarativeXyPoint> DeclarativeSplineSeries::points()
29 {
24 {
30 return DeclarativeXySeries::points();
25 return QDeclarativeListProperty<DeclarativeXyPoint>(this, 0, &DeclarativeXySeries::appendPoints);
31 }
26 }
32
27
33 void DeclarativeSplineSeries::appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list,
28 void DeclarativeSplineSeries::appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list,
@@ -17,13 +17,10 public:
17 explicit DeclarativeSplineSeries(QObject *parent = 0);
17 explicit DeclarativeSplineSeries(QObject *parent = 0);
18
18
19 public:
19 public:
20 void seriesComplete();
20 virtual void componentComplete();
21 QObject *seriesObject();
22
23 public:
24 QDeclarativeListProperty<DeclarativeXyPoint> points();
21 QDeclarativeListProperty<DeclarativeXyPoint> points();
25
22
26 public slots:
23 public Q_SLOTS:
27 static void appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list,
24 static void appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list,
28 DeclarativeXyPoint *element);
25 DeclarativeXyPoint *element);
29 };
26 };
@@ -16,16 +16,6 void DeclarativeXySeries::classBegin()
16 {
16 {
17 }
17 }
18
18
19 void DeclarativeXySeries::componentComplete()
20 {
21 seriesComplete();
22 }
23
24 QDeclarativeListProperty<DeclarativeXyPoint> DeclarativeXySeries::points()
25 {
26 return QDeclarativeListProperty<DeclarativeXyPoint>(seriesObject(), 0, &DeclarativeXySeries::appendPoints);
27 }
28
29 void DeclarativeXySeries::appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list,
19 void DeclarativeXySeries::appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list,
30 DeclarativeXyPoint *element)
20 DeclarativeXyPoint *element)
31 {
21 {
@@ -19,19 +19,15 public:
19 ~DeclarativeXySeries();
19 ~DeclarativeXySeries();
20
20
21 public: // from QDeclarativeParserStatus
21 public: // from QDeclarativeParserStatus
22 void classBegin();
22 virtual void classBegin();
23 void componentComplete();
23 virtual void componentComplete() = 0;
24
24
25 public:
25 public:
26 QDeclarativeListProperty<DeclarativeXyPoint> points();
26 virtual QDeclarativeListProperty<DeclarativeXyPoint> points() = 0;
27
27
28 public Q_SLOTS:
28 public Q_SLOTS:
29 static void appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list,
29 static void appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list,
30 DeclarativeXyPoint *element);
30 DeclarativeXyPoint *element);
31
32 protected:
33 virtual void seriesComplete() = 0;
34 virtual QObject *seriesObject() = 0;
35 };
31 };
36
32
37 QTCOMMERCIALCHART_END_NAMESPACE
33 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now