diff options
author | David Faure <faure@kde.org> | 2009-08-10 07:37:18 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-08-10 07:44:55 (GMT) |
commit | 2be387f3e94f84cf0167cdc3871de0d0af85c62d (patch) | |
tree | db0fed1caee646d360dbaaaf7a43173b7be9ab11 /src/corelib/tools | |
parent | 4942e2834c1da00bfceec6430ce351888efc1976 (diff) | |
download | Qt-2be387f3e94f84cf0167cdc3871de0d0af85c62d.zip Qt-2be387f3e94f84cf0167cdc3871de0d0af85c62d.tar.gz Qt-2be387f3e94f84cf0167cdc3871de0d0af85c62d.tar.bz2 |
Make QTimeLine::start() restart from the beginning as the documentation says.
The documentation implies that start restarts. Which it did, but only if the
timeline was finished _and_ the duration hadn't been changed meanwhile.
So after a setDuration(), start() would do nothing, which was unexpected.
Merge-request: 1145
Reviewed-by: Olivier Goffart <ogoffart@trolltech.com>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qtimeline.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/corelib/tools/qtimeline.cpp b/src/corelib/tools/qtimeline.cpp index e32fc03..7402ba6 100644 --- a/src/corelib/tools/qtimeline.cpp +++ b/src/corelib/tools/qtimeline.cpp @@ -663,6 +663,7 @@ qreal QTimeLine::valueForTime(int msec) const second). You can change the update interval by calling setUpdateInterval(). + The timeline will start from position 0, or the end if going backward. If you want to resume a stopped timeline without restarting, you can call resume() instead. @@ -675,10 +676,8 @@ void QTimeLine::start() qWarning("QTimeLine::start: already running"); return; } - int curTime = d->currentTime; - if (curTime == d->duration && d->direction == Forward) - curTime = 0; - else if (curTime == 0 && d->direction == Backward) + int curTime = 0; + if (d->direction == Backward) curTime = d->duration; d->timerId = startTimer(d->updateInterval); d->startTime = curTime; @@ -694,7 +693,7 @@ void QTimeLine::start() frame and value at regular intervals. In contrast to start(), this function does not restart the timeline before - is resumes. + it resumes. \sa start(), updateInterval(), frameChanged(), valueChanged() */ |