##// END OF EJS Templates
Fix dynamic qml axis switch...
Titta Heikkala -
r2597:949e3e70938f
parent child
Show More
@@ -372,7 +372,7 void DeclarativeChart::handleAxisXSet(QAbstractAxis *axis)
372 QAbstractSeries *s = qobject_cast<QAbstractSeries *>(sender());
372 QAbstractSeries *s = qobject_cast<QAbstractSeries *>(sender());
373 if (axis && s) {
373 if (axis && s) {
374 if (!m_chart->axes(Qt::Horizontal).contains(axis))
374 if (!m_chart->axes(Qt::Horizontal).contains(axis))
375 m_chart->addAxis(axis, Qt::AlignBottom);
375 m_chart->setAxisX(axis, s);
376 if (!s->attachedAxes().contains(axis))
376 if (!s->attachedAxes().contains(axis))
377 s->attachAxis(axis);
377 s->attachAxis(axis);
378 } else {
378 } else {
@@ -384,8 +384,14 void DeclarativeChart::handleAxisXTopSet(QAbstractAxis *axis)
384 {
384 {
385 QAbstractSeries *s = qobject_cast<QAbstractSeries *>(sender());
385 QAbstractSeries *s = qobject_cast<QAbstractSeries *>(sender());
386 if (axis && s) {
386 if (axis && s) {
387 if (!m_chart->axes(Qt::Horizontal).contains(axis))
387 if (!m_chart->axes(Qt::Horizontal).contains(axis)) {
388 QList<QAbstractAxis *> oldAxes = m_chart->axes(Qt::Horizontal, s);
389 foreach (QAbstractAxis* a, oldAxes) {
390 m_chart->removeAxis(a);
391 delete a;
392 }
388 m_chart->addAxis(axis, Qt::AlignTop);
393 m_chart->addAxis(axis, Qt::AlignTop);
394 }
389 if (!s->attachedAxes().contains(axis))
395 if (!s->attachedAxes().contains(axis))
390 s->attachAxis(axis);
396 s->attachAxis(axis);
391 } else {
397 } else {
@@ -398,7 +404,7 void DeclarativeChart::handleAxisYSet(QAbstractAxis *axis)
398 QAbstractSeries *s = qobject_cast<QAbstractSeries *>(sender());
404 QAbstractSeries *s = qobject_cast<QAbstractSeries *>(sender());
399 if (axis && s) {
405 if (axis && s) {
400 if (!m_chart->axes(Qt::Vertical).contains(axis))
406 if (!m_chart->axes(Qt::Vertical).contains(axis))
401 m_chart->addAxis(axis, Qt::AlignLeft);
407 m_chart->setAxisY(axis, s);
402 if (!s->attachedAxes().contains(axis))
408 if (!s->attachedAxes().contains(axis))
403 s->attachAxis(axis);
409 s->attachAxis(axis);
404 } else {
410 } else {
@@ -410,8 +416,14 void DeclarativeChart::handleAxisYRightSet(QAbstractAxis *axis)
410 {
416 {
411 QAbstractSeries *s = qobject_cast<QAbstractSeries *>(sender());
417 QAbstractSeries *s = qobject_cast<QAbstractSeries *>(sender());
412 if (axis && s) {
418 if (axis && s) {
413 if (!m_chart->axes(Qt::Vertical).contains(axis))
419 if (!m_chart->axes(Qt::Vertical).contains(axis)) {
420 QList<QAbstractAxis *> oldAxes = m_chart->axes((Qt::Vertical), s);
421 foreach (QAbstractAxis* a, oldAxes) {
422 m_chart->removeAxis(a);
423 delete a;
424 }
414 m_chart->addAxis(axis, Qt::AlignRight);
425 m_chart->addAxis(axis, Qt::AlignRight);
426 }
415 if (!s->attachedAxes().contains(axis))
427 if (!s->attachedAxes().contains(axis))
416 s->attachAxis(axis);
428 s->attachAxis(axis);
417 } else {
429 } else {
General Comments 0
You need to be logged in to leave comments. Login now