diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-08-12 12:56:19 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-08-12 12:56:54 (GMT) |
commit | 385f98c222154f3af402f2f3b13103add9cfa757 (patch) | |
tree | 658b648997a7f828e4aa957f845d3f52a8051e32 /src/corelib | |
parent | e7e31867ed9857b17dbb4aa4e6cb06c93234be4f (diff) | |
download | Qt-385f98c222154f3af402f2f3b13103add9cfa757.zip Qt-385f98c222154f3af402f2f3b13103add9cfa757.tar.gz Qt-385f98c222154f3af402f2f3b13103add9cfa757.tar.bz2 |
oops: fix an issue when going backward and there is only 1 key value set
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/animation/qvariantanimation.cpp | 15 |
1 files 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 } |