From 1d225571334334f1f938607c7d5ee34623f13b55 2012-03-22 11:13:05 From: sauimone Date: 2012-03-22 11:13:05 Subject: [PATCH] barchart animation fix --- diff --git a/src/animations/baranimation.cpp b/src/animations/baranimation.cpp index afe3294..d1dea67 100644 --- a/src/animations/baranimation.cpp +++ b/src/animations/baranimation.cpp @@ -28,9 +28,13 @@ QVariant BarAnimation::interpolated(const QVariant &from, const QVariant &to, qr Q_ASSERT(startVector.count() == endVector.count()) ; for(int i =0 ;i< startVector.count();i++){ - //QRectF value = startVector[i] + ((endVector[i] - startVector[i]) * progress); - QPointF topLeft = startVector[i].topLeft() + ((endVector[i].topLeft() - startVector[i].topLeft()) * progress); - QSizeF size = startVector[i].size() + ((endVector[i].size() - startVector[i].size()) * progress); + qreal w = endVector[i].width(); + qreal h = startVector[i].height() + ((endVector[i].height() - startVector[i].height()) * progress); + qreal x = endVector[i].topLeft().x(); + qreal y = endVector[i].topLeft().y() + endVector[i].height() - h; + + QPointF topLeft(x,y); + QSizeF size(w,h); QRectF value(topLeft,size); result << value; } diff --git a/src/animations/chartanimator.cpp b/src/animations/chartanimator.cpp index c3c719d..cb3c965 100644 --- a/src/animations/chartanimator.cpp +++ b/src/animations/chartanimator.cpp @@ -273,7 +273,6 @@ void ChartAnimator::updateLayout(BarChartItem* item, const QVector &oldL qDebug() << "ChartAnimator::updateLayout"; BarAnimation* animation = static_cast(m_animations.value(item)); Q_ASSERT(animation); -// animation->updateValues(layout); animation->setDuration(duration); animation->setKeyValueAt(0.0, qVariantFromValue(oldLayout)); animation->setKeyValueAt(1.0, qVariantFromValue(newLayout));