##// END OF EJS Templates
Switched order of add series/set axis in declarative chart
Tero Ahola -
r1903:77167a85d8cf
parent child
Show More
@@ -262,7 +262,11 void DeclarativeChart::componentComplete()
262 {
262 {
263 foreach(QObject *child, children()) {
263 foreach(QObject *child, children()) {
264 if (qobject_cast<QAbstractSeries *>(child)) {
264 if (qobject_cast<QAbstractSeries *>(child)) {
265 m_chart->addSeries(qobject_cast<QAbstractSeries *>(child));
265 // Add series to the chart
266 QAbstractSeries *series = qobject_cast<QAbstractSeries *>(child);
267 m_chart->addSeries(series);
268
269 // Set optional user defined axes and connect axis related signals
266 if (qobject_cast<DeclarativeLineSeries *>(child)) {
270 if (qobject_cast<DeclarativeLineSeries *>(child)) {
267 DeclarativeLineSeries *s = qobject_cast<DeclarativeLineSeries *>(child);
271 DeclarativeLineSeries *s = qobject_cast<DeclarativeLineSeries *>(child);
268 connect(s, SIGNAL(axisXChanged(QAbstractAxis *)), this, SLOT(handleAxisXSet(QAbstractAxis *)));
272 connect(s, SIGNAL(axisXChanged(QAbstractAxis *)), this, SLOT(handleAxisXSet(QAbstractAxis *)));
@@ -324,15 +328,14 void DeclarativeChart::componentComplete()
324 setAxisX(s->axisX(), s);
328 setAxisX(s->axisX(), s);
325 setAxisY(s->axisY(), s);
329 setAxisY(s->axisY(), s);
326 }
330 }
331
332 // Create the missing axes for the series that cannot be painted without axes
333 createDefaultAxes(series);
327 } else if(qobject_cast<QAbstractAxis *>(child)) {
334 } else if(qobject_cast<QAbstractAxis *>(child)) {
328 // Do nothing, axes are set for the chart in the context of series
335 // Do nothing, axes are set for the chart in the context of series
329 }
336 }
330 }
337 }
331
338
332 // Create the missing axes for the series that cannot be painted without axes
333 foreach(QAbstractSeries *series, m_chart->series())
334 createDefaultAxes(series);
335
336 QDeclarativeItem::componentComplete();
339 QDeclarativeItem::componentComplete();
337 }
340 }
338
341
General Comments 0
You need to be logged in to leave comments. Login now