From 385f98c222154f3af402f2f3b13103add9cfa757 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 12 Aug 2009 14:56:19 +0200 Subject: oops: fix an issue when going backward and there is only 1 key value set --- src/corelib/animation/qvariantanimation.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp index 04e0980..e647318 100644 --- a/src/corelib/animation/qvariantanimation.cpp +++ b/src/corelib/animation/qvariantanimation.cpp @@ -248,15 +248,22 @@ void QVariantAnimationPrivate::recalculateCurrentInterval(bool force/*=false*/) } } } else if (it == keyValues.constBegin()) { - if (it->first == progress || it->first == 0) { + if (it+1 != keyValues.constEnd() && (it->first == progress || it->first == 0)) { //the item pointed to by it is the start element in the range //we also test if the current element is for progress 0 (ie the real start) because //some easing curves might get the progress below 0. currentInterval.start = *it; currentInterval.end = *(it+1); - } else if (direction == QVariantAnimation::Forward && defaultStartValue.isValid()) { - currentInterval.start = qMakePair(qreal(0), defaultStartValue); - currentInterval.end = *it; + } else if (defaultStartValue.isValid()) { + if (direction == QVariantAnimation::Forward) { + //we should have an end value + currentInterval.start = qMakePair(qreal(0), defaultStartValue); + currentInterval.end = *it; + } else { + //we should have a start value + currentInterval.start = *it; + currentInterval.end = qMakePair(qreal(1), defaultStartValue); + } } else { ///this should not happen } -- cgit v0.12