##// END OF EJS Templates
DeclarativeBarSeries to DeclarativeAbstractBarSeries
sauimone -
r1591:518376bc2c18
parent child
Show More
@@ -60,14 +60,14 void DeclarativeBarSet::setValues(QVariantList values)
60 }
60 }
61 }
61 }
62
62
63 DeclarativeBarSeries::DeclarativeBarSeries(QDeclarativeItem *parent) :
63 DeclarativeAbstractBarSeries::DeclarativeAbstractBarSeries(QDeclarativeItem *parent) :
64 QAbstractBarSeries(parent)
64 QAbstractBarSeries(parent)
65 {
65 {
66 connect(this, SIGNAL(barsetsAdded(QList<QBarSet*>)), this, SLOT(handleAdded(QList<QBarSet*>)));
66 connect(this, SIGNAL(barsetsAdded(QList<QBarSet*>)), this, SLOT(handleAdded(QList<QBarSet*>)));
67 connect(this, SIGNAL(barsetsRemoved(QList<QBarSet*>)), this, SLOT(handleRemoved(QList<QBarSet*>)));
67 connect(this, SIGNAL(barsetsRemoved(QList<QBarSet*>)), this, SLOT(handleRemoved(QList<QBarSet*>)));
68 }
68 }
69
69
70 void DeclarativeBarSeries::handleAdded(QList<QBarSet* > barsets)
70 void DeclarativeAbstractBarSeries::handleAdded(QList<QBarSet* > barsets)
71 {
71 {
72 foreach(QBarSet *b, barsets) {
72 foreach(QBarSet *b, barsets) {
73 DeclarativeBarSet *barset = qobject_cast<DeclarativeBarSet *>(b);
73 DeclarativeBarSet *barset = qobject_cast<DeclarativeBarSet *>(b);
@@ -75,7 +75,7 void DeclarativeBarSeries::handleAdded(QList<QBarSet* > barsets)
75 }
75 }
76 }
76 }
77
77
78 void DeclarativeBarSeries::handleRemoved(QList<QBarSet* > barsets)
78 void DeclarativeAbstractBarSeries::handleRemoved(QList<QBarSet* > barsets)
79 {
79 {
80 foreach(QBarSet *b, barsets) {
80 foreach(QBarSet *b, barsets) {
81 DeclarativeBarSet *barset = qobject_cast<DeclarativeBarSet *>(b);
81 DeclarativeBarSet *barset = qobject_cast<DeclarativeBarSet *>(b);
@@ -83,11 +83,11 void DeclarativeBarSeries::handleRemoved(QList<QBarSet* > barsets)
83 }
83 }
84 }
84 }
85
85
86 void DeclarativeBarSeries::classBegin()
86 void DeclarativeAbstractBarSeries::classBegin()
87 {
87 {
88 }
88 }
89
89
90 void DeclarativeBarSeries::componentComplete()
90 void DeclarativeAbstractBarSeries::componentComplete()
91 {
91 {
92 foreach(QObject *child, children()) {
92 foreach(QObject *child, children()) {
93 if (qobject_cast<DeclarativeBarSet *>(child)) {
93 if (qobject_cast<DeclarativeBarSet *>(child)) {
@@ -102,39 +102,39 void DeclarativeBarSeries::componentComplete()
102 }
102 }
103 }
103 }
104
104
105 void DeclarativeBarSeries::setAxisX(QAbstractAxis *axis)
105 void DeclarativeAbstractBarSeries::setAxisX(QAbstractAxis *axis)
106 {
106 {
107 chart()->setAxisX(axis, this);
107 chart()->setAxisX(axis, this);
108 }
108 }
109
109
110 QAbstractAxis *DeclarativeBarSeries::axisX()
110 QAbstractAxis *DeclarativeAbstractBarSeries::axisX()
111 {
111 {
112 return chart()->axisX(this);
112 return chart()->axisX(this);
113 }
113 }
114
114
115 void DeclarativeBarSeries::setAxisY(QAbstractAxis *axis)
115 void DeclarativeAbstractBarSeries::setAxisY(QAbstractAxis *axis)
116 {
116 {
117 chart()->setAxisY(axis, this);
117 chart()->setAxisY(axis, this);
118 }
118 }
119
119
120 QAbstractAxis *DeclarativeBarSeries::axisY()
120 QAbstractAxis *DeclarativeAbstractBarSeries::axisY()
121 {
121 {
122 return chart()->axisY(this);
122 return chart()->axisY(this);
123 }
123 }
124
124
125 QDeclarativeListProperty<QObject> DeclarativeBarSeries::seriesChildren()
125 QDeclarativeListProperty<QObject> DeclarativeAbstractBarSeries::seriesChildren()
126 {
126 {
127 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren);
127 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeAbstractBarSeries::appendSeriesChildren);
128 }
128 }
129
129
130 void DeclarativeBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
130 void DeclarativeAbstractBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
131 {
131 {
132 // Empty implementation; the children are parsed in componentComplete instead
132 // Empty implementation; the children are parsed in componentComplete instead
133 Q_UNUSED(list);
133 Q_UNUSED(list);
134 Q_UNUSED(element);
134 Q_UNUSED(element);
135 }
135 }
136
136
137 DeclarativeBarSet *DeclarativeBarSeries::at(int index)
137 DeclarativeBarSet *DeclarativeAbstractBarSeries::at(int index)
138 {
138 {
139 QList<QBarSet*> setList = barSets();
139 QList<QBarSet*> setList = barSets();
140 if (index >= 0 && index < setList.count())
140 if (index >= 0 && index < setList.count())
@@ -143,7 +143,7 DeclarativeBarSet *DeclarativeBarSeries::at(int index)
143 return 0;
143 return 0;
144 }
144 }
145
145
146 DeclarativeBarSet *DeclarativeBarSeries::insert(int index, QString label, QVariantList values)
146 DeclarativeBarSet *DeclarativeAbstractBarSeries::insert(int index, QString label, QVariantList values)
147 {
147 {
148 int insertIndex = index;
148 int insertIndex = index;
149 if (insertIndex < 0)
149 if (insertIndex < 0)
@@ -206,7 +206,7 QAbstractAxis *DeclarativeGroupedBarSeries::axisY()
206
206
207 QDeclarativeListProperty<QObject> DeclarativeGroupedBarSeries::seriesChildren()
207 QDeclarativeListProperty<QObject> DeclarativeGroupedBarSeries::seriesChildren()
208 {
208 {
209 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren);
209 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeAbstractBarSeries::appendSeriesChildren);
210 }
210 }
211
211
212 void DeclarativeGroupedBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
212 void DeclarativeGroupedBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
@@ -282,7 +282,7 QAbstractAxis *DeclarativeStackedBarSeries::axisY()
282
282
283 QDeclarativeListProperty<QObject> DeclarativeStackedBarSeries::seriesChildren()
283 QDeclarativeListProperty<QObject> DeclarativeStackedBarSeries::seriesChildren()
284 {
284 {
285 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren);
285 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeAbstractBarSeries::appendSeriesChildren);
286 }
286 }
287
287
288 void DeclarativeStackedBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
288 void DeclarativeStackedBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
@@ -358,7 +358,7 QAbstractAxis *DeclarativePercentBarSeries::axisY()
358
358
359 QDeclarativeListProperty<QObject> DeclarativePercentBarSeries::seriesChildren()
359 QDeclarativeListProperty<QObject> DeclarativePercentBarSeries::seriesChildren()
360 {
360 {
361 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren);
361 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeAbstractBarSeries::appendSeriesChildren);
362 }
362 }
363
363
364 void DeclarativePercentBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
364 void DeclarativePercentBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
@@ -388,6 +388,6 DeclarativeBarSet *DeclarativePercentBarSeries::insert(int index, QString label,
388 return 0;
388 return 0;
389 }
389 }
390
390
391 #include "moc_declarativebarseries.cpp"
391 #include "moc_declarativeabstractbarseries.cpp"
392
392
393 QTCOMMERCIALCHART_END_NAMESPACE
393 QTCOMMERCIALCHART_END_NAMESPACE
@@ -58,7 +58,7 private Q_SLOTS:
58 void handleCountChanged(int index, int count);
58 void handleCountChanged(int index, int count);
59 };
59 };
60
60
61 class DeclarativeBarSeries : public QAbstractBarSeries, public QDeclarativeParserStatus
61 class DeclarativeAbstractBarSeries : public QAbstractBarSeries, public QDeclarativeParserStatus
62 {
62 {
63 Q_OBJECT
63 Q_OBJECT
64 Q_INTERFACES(QDeclarativeParserStatus)
64 Q_INTERFACES(QDeclarativeParserStatus)
@@ -68,7 +68,7 class DeclarativeBarSeries : public QAbstractBarSeries, public QDeclarativeParse
68 Q_CLASSINFO("DefaultProperty", "seriesChildren")
68 Q_CLASSINFO("DefaultProperty", "seriesChildren")
69
69
70 public:
70 public:
71 explicit DeclarativeBarSeries(QDeclarativeItem *parent = 0);
71 explicit DeclarativeAbstractBarSeries(QDeclarativeItem *parent = 0);
72 void setAxisX(QAbstractAxis *axis);
72 void setAxisX(QAbstractAxis *axis);
73 QAbstractAxis *axisX();
73 QAbstractAxis *axisX();
74 void setAxisY(QAbstractAxis *axis);
74 void setAxisY(QAbstractAxis *axis);
General Comments 0
You need to be logged in to leave comments. Login now