From 29ed1b505c34fe6120c3ae4934294018050aec28 2012-11-26 12:58:48 From: Michal Klocek Date: 2012-11-26 12:58:48 Subject: [PATCH] bugfix signals not reconnected when domain changed --- diff --git a/src/chartdataset.cpp b/src/chartdataset.cpp index 2062015..8a5c2ea 100644 --- a/src/chartdataset.cpp +++ b/src/chartdataset.cpp @@ -197,13 +197,18 @@ bool ChartDataSet::attachAxis(QAbstractSeries* series,QAbstractAxis *axis) if(!domain->attachAxis(axis)) return false; - series->d_ptr->m_axes<d_ptr->m_series<d_ptr->domain()){ + foreach(QAbstractAxis* axis,series->d_ptr->m_axes){ + series->d_ptr->domain()->detachAxis(axis); + domain->attachAxis(axis); + } series->d_ptr->setDomain(domain); series->d_ptr->initializeDomain(); } + + series->d_ptr->m_axes<d_ptr->m_series<d_ptr->initializeAxes(); axis->d_ptr->initializeDomain(domain); diff --git a/src/domain/xlogydomain.cpp b/src/domain/xlogydomain.cpp index 46bf4cb..846f46b 100644 --- a/src/domain/xlogydomain.cpp +++ b/src/domain/xlogydomain.cpp @@ -158,24 +158,22 @@ QPointF XLogYDomain::calculateDomainPoint(const QPointF &point) const bool XLogYDomain::attachAxis(QAbstractAxis* axis) { - AbstractDomain::attachAxis(axis); QLogValueAxis *logAxis = qobject_cast(axis); if(logAxis && logAxis->orientation()==Qt::Vertical) QObject::connect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleVerticalAxisBaseChanged(qreal))); - return true; + return AbstractDomain::attachAxis(axis); } bool XLogYDomain::detachAxis(QAbstractAxis* axis) { - AbstractDomain::detachAxis(axis); QLogValueAxis *logAxis = qobject_cast(axis); if(logAxis && logAxis->orientation()==Qt::Vertical) QObject::disconnect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleVerticalAxisBaseChanged(qreal))); - return true; + return AbstractDomain::detachAxis(axis); } void XLogYDomain::handleVerticalAxisBaseChanged(qreal baseY)