##// END OF EJS Templates
barchart animation fix
sauimone -
r693:1d2255713343
parent child
Show More
@@ -28,9 +28,13 QVariant BarAnimation::interpolated(const QVariant &from, const QVariant &to, qr
28 Q_ASSERT(startVector.count() == endVector.count()) ;
28 Q_ASSERT(startVector.count() == endVector.count()) ;
29
29
30 for(int i =0 ;i< startVector.count();i++){
30 for(int i =0 ;i< startVector.count();i++){
31 //QRectF value = startVector[i] + ((endVector[i] - startVector[i]) * progress);
31 qreal w = endVector[i].width();
32 QPointF topLeft = startVector[i].topLeft() + ((endVector[i].topLeft() - startVector[i].topLeft()) * progress);
32 qreal h = startVector[i].height() + ((endVector[i].height() - startVector[i].height()) * progress);
33 QSizeF size = startVector[i].size() + ((endVector[i].size() - startVector[i].size()) * progress);
33 qreal x = endVector[i].topLeft().x();
34 qreal y = endVector[i].topLeft().y() + endVector[i].height() - h;
35
36 QPointF topLeft(x,y);
37 QSizeF size(w,h);
34 QRectF value(topLeft,size);
38 QRectF value(topLeft,size);
35 result << value;
39 result << value;
36 }
40 }
@@ -273,7 +273,6 void ChartAnimator::updateLayout(BarChartItem* item, const QVector<QRectF> &oldL
273 qDebug() << "ChartAnimator::updateLayout";
273 qDebug() << "ChartAnimator::updateLayout";
274 BarAnimation* animation = static_cast<BarAnimation*>(m_animations.value(item));
274 BarAnimation* animation = static_cast<BarAnimation*>(m_animations.value(item));
275 Q_ASSERT(animation);
275 Q_ASSERT(animation);
276 // animation->updateValues(layout);
277 animation->setDuration(duration);
276 animation->setDuration(duration);
278 animation->setKeyValueAt(0.0, qVariantFromValue(oldLayout));
277 animation->setKeyValueAt(0.0, qVariantFromValue(oldLayout));
279 animation->setKeyValueAt(1.0, qVariantFromValue(newLayout));
278 animation->setKeyValueAt(1.0, qVariantFromValue(newLayout));
General Comments 0
You need to be logged in to leave comments. Login now