aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickanimatedsprite.cpp
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2012-05-09 17:01:37 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-11 06:20:21 +0200
commit67fb05034c9758d25464f2103ae6068dbc9bb110 (patch)
treef7e2f6d933fc5f9830d64ad698549b3c4c0ebbf3 /src/quick/items/qquickanimatedsprite.cpp
parent9c14462bad6c83e85db8960d0f48b42b198189a6 (diff)
AnimatedSprite framespeed properties now restart animation.
For a simple element, we're taking the simple solution for the interaction of changing these parameters during an animation. Task-number: QTBUG-25045 Task-number: QTBUG-25043 Change-Id: I1fb37fc029f23ce92558cb2e5deed80a69784173 Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/quick/items/qquickanimatedsprite.cpp')
-rw-r--r--src/quick/items/qquickanimatedsprite.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/quick/items/qquickanimatedsprite.cpp b/src/quick/items/qquickanimatedsprite.cpp
index 7110351cc7..204900177c 100644
--- a/src/quick/items/qquickanimatedsprite.cpp
+++ b/src/quick/items/qquickanimatedsprite.cpp
@@ -237,19 +237,23 @@ struct AnimatedSpriteVertices {
/*!
\qmlproperty qreal QtQuick2::AnimatedSprite::frameRate
- Frames per second to show in the animation. Values below 0 are invalid.
+ Frames per second to show in the animation. Values equal to or below 0 are invalid.
If frameRate is valid then it will be used to calculate the duration of the frames.
If not, and frameDuration is valid , then frameDuration will be used.
+
+ Changing this parameter will restart the animation.
*/
/*!
\qmlproperty int QtQuick2::AnimatedSprite::frameDuration
- Duration of each frame of the animation. Values below 0 are invalid.
+ Duration of each frame of the animation. Values equal to or below 0 are invalid.
If frameRate is valid then it will be used to calculate the duration of the frames.
If not, and frameDuration is valid, then frameDuration will be used.
+
+ Changing this parameter will restart the animation.
*/
/*!
@@ -314,6 +318,8 @@ struct AnimatedSpriteVertices {
If frameSync is set to true, it overrides both frameRate and frameDuration.
Default is false.
+
+ Changing this parameter will restart the animation.
*/
/*!
@@ -383,6 +389,11 @@ void QQuickAnimatedSprite::start()
return;
m_curLoop = 0;
m_timestamp.start();
+ if (m_spriteEngine) {
+ m_spriteEngine->stop(0);
+ m_spriteEngine->updateSprites(0);
+ m_spriteEngine->start(0);
+ }
m_running = true;
emit runningChanged(true);
update();
@@ -393,6 +404,7 @@ void QQuickAnimatedSprite::stop()
if (!m_running)
return;
m_running = false;
+ m_pauseOffset = 0;
emit runningChanged(false);
}
@@ -550,7 +562,7 @@ void QQuickAnimatedSprite::prepareNextFrame()
if (m_node == 0) //error creating node
return;
- uint timeInt = m_timestamp.elapsed() + m_pauseOffset;
+ int timeInt = m_timestamp.elapsed() + m_pauseOffset;
qreal time = timeInt / 1000.;
m_material->elementHeight = height();
m_material->elementWidth = width();