aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickanimatedsprite.cpp
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@digia.com>2014-09-03 11:15:25 +0200
committerJan Arve Sæther <jan-arve.saether@digia.com>2014-09-12 14:06:17 +0200
commit404640392b28d253c24330eb8acc0c30d838af92 (patch)
tree9d3901fdaa8be186c5b0d9084dcb27fa0f6453a8 /src/quick/items/qquickanimatedsprite.cpp
parent7d03dfe4192f164e837df2c5652b83ffe04840d6 (diff)
Made emission of AnimatedSprite currentFrameChanges consistent.
Both the order was wrong and sometimes the currentFrame property did not correspond to the 'arg' argument that was carried by the signal. The order was sometimes like this: [window got exposed, m_running == false] currentFrame: 1, arg: 1 <== Unexpected, its not running [start() got called, m_running == true] currentFrame: 1, arg: 0 <== Unexpected, they are inequal currentFrame: 2, arg: 2 <== Not sure what to expect here The root of the problem was that we would enter prepareNextFrame on startup (due to QQuickWindow::exposeEvent) even if we were in the stopped state. Getting rid of the first invalid emission solved the issue. Change-Id: Iba002ee91d4d1acafcf4fd0911c28c93a4bc6fd5 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'src/quick/items/qquickanimatedsprite.cpp')
-rw-r--r--src/quick/items/qquickanimatedsprite.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/quick/items/qquickanimatedsprite.cpp b/src/quick/items/qquickanimatedsprite.cpp
index bf5d452f34..3aaec53c54 100644
--- a/src/quick/items/qquickanimatedsprite.cpp
+++ b/src/quick/items/qquickanimatedsprite.cpp
@@ -577,7 +577,7 @@ void QQuickAnimatedSprite::prepareNextFrame()
double frameAt; //double just for modf
qreal progress = 0.0;
int lastFrame = m_curFrame;
- if (!m_paused) {
+ if (m_running && !m_paused) {
//Advance State (keeps time for psuedostates)
m_spriteEngine->updateSprites(timeInt);
@@ -607,10 +607,8 @@ void QQuickAnimatedSprite::prepareNextFrame()
}
if (m_loops > 0 && m_curLoop >= m_loops) {
frameAt = 0;
- if (m_running) {
- m_running = false;
- emit runningChanged(false);
- }
+ m_running = false;
+ emit runningChanged(false);
}
} else {
frameAt = m_curFrame;