diff options
author | sauimone <samu.uimonen@digia.com> | 2012-07-11 17:06:51 +0300 |
---|---|---|
committer | sauimone <samu.uimonen@digia.com> | 2012-07-11 17:06:51 +0300 |
commit | 93894274373cc181bc79dc1086566cdeee22e9c2 (patch) | |
tree | 87d3e5bc1d00bd2b20477f8b20e585decd09a6a8 /src/animations | |
parent | 0b4da0006934503e6328ca79553f6686b3dc3a83 (diff) |
animation for horizontal barchart
Diffstat (limited to 'src/animations')
-rw-r--r-- | src/animations/horizontalbaranimation.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/animations/horizontalbaranimation.cpp b/src/animations/horizontalbaranimation.cpp index 250561de..15a2ef89 100644 --- a/src/animations/horizontalbaranimation.cpp +++ b/src/animations/horizontalbaranimation.cpp @@ -39,11 +39,22 @@ HorizontalBarAnimation::~HorizontalBarAnimation() QVariant HorizontalBarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const { - // TODO: - Q_UNUSED(from); - Q_UNUSED(to); - Q_UNUSED(progress); - return to; + QVector<QRectF> startVector = qVariantValue<QVector<QRectF> >(from); + QVector<QRectF> endVector = qVariantValue<QVector<QRectF> >(to); + QVector<QRectF> result; + + Q_ASSERT(startVector.count() == endVector.count()); + + for(int i = 0; i < startVector.count(); i++) { + qreal h = endVector[i].height(); + qreal w = startVector[i].width() + ((endVector[i].width() - startVector[i].width()) * progress); + qreal x = endVector[i].topLeft().x(); + qreal y = endVector[i].topLeft().y(); + + QRectF value(x,y,w,h); + result << value; + } + return qVariantFromValue(result); } #include "moc_horizontalbaranimation_p.cpp" |