From 21fb1e963c663bb54e1764d07ff8c51b3eba07b0 2012-04-04 08:32:56 From: Michal Klocek Date: 2012-04-04 08:32:56 Subject: [PATCH] Bugfixes for unnesery geometry changes --- diff --git a/src/chartpresenter.cpp b/src/chartpresenter.cpp index b6b388d..ef2b61e 100644 --- a/src/chartpresenter.cpp +++ b/src/chartpresenter.cpp @@ -247,6 +247,7 @@ void ChartPresenter::handleSeriesAdded(QSeries* series,Domain* domain) } case QSeries::SeriesTypeScatter: { + QScatterSeries *scatterSeries = static_cast(series); ScatterChartItem *scatter = new ScatterChartItem(scatterSeries,this); if(m_options.testFlag(QChart::SeriesAnimations)) { @@ -343,7 +344,6 @@ void ChartPresenter::setAnimationOptions(QChart::AnimationOptions options) if(m_options!=QChart::NoAnimation && !m_animator) { m_animator= new ChartAnimator(this); - } resetAllElements(); } @@ -504,9 +504,13 @@ void ChartPresenter::updateLayout() m_backgroundItem->setRect(m_rect.adjusted(m_marginTiny,m_marginTiny, -m_marginTiny, -m_marginTiny)); } - m_chartRect = m_rect.adjusted(m_chartMargins.left(),m_chartMargins.top(),-m_chartMargins.right(),-m_chartMargins.bottom()); + QRectF chartRect = m_rect.adjusted(m_chartMargins.left(),m_chartMargins.top(),-m_chartMargins.right(),-m_chartMargins.bottom()); + + if(m_chartRect!=chartRect){ + m_chartRect=chartRect; + emit geometryChanged(m_chartRect); + } - emit geometryChanged(m_chartRect); legend->setGeometry(m_rect.adjusted(m_legendMargins.left(),m_legendMargins.top(),-m_legendMargins.right(),-m_legendMargins.bottom())); } diff --git a/src/scatterseries/scatterchartitem.cpp b/src/scatterseries/scatterchartitem.cpp index 80025df..fb7e4f3 100644 --- a/src/scatterseries/scatterchartitem.cpp +++ b/src/scatterseries/scatterchartitem.cpp @@ -107,7 +107,7 @@ void ScatterChartItem::setLayout(QVector& points) return; } - int diff = XYChartItem::points().size() - points.size(); + int diff = m_items.childItems().size() - points.size(); if(diff>0) { deletePoints(diff);