Don't start running if a frame property is set

This fixes an error where running couldn't be reliably set, if a frame
property was also being set during initialization. With this fixed, the
autotest is no longer unstable.

Also fixed is a related issue where start/stop/restart were active
before componentComplete.

Change-Id: I34c6d872f2f146d38c65167eda8c0a97525d7f4e
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
This commit is contained in:
Alan Alpert 2012-06-13 18:49:12 +10:00 committed by Qt by Nokia
parent cbc6c299d4
commit 369423f741
3 changed files with 11 additions and 8 deletions

View File

@ -400,7 +400,8 @@ void QQuickAnimatedSprite::componentComplete()
void QQuickAnimatedSprite::start()
{
if (m_running)
m_running = true;
if (!isComponentComplete())
return;
m_curLoop = 0;
m_timestamp.start();
@ -409,16 +410,16 @@ void QQuickAnimatedSprite::start()
m_spriteEngine->updateSprites(0);
m_spriteEngine->start(0);
}
m_running = true;
emit currentFrameChanged(0);
emit runningChanged(true);
update();
}
void QQuickAnimatedSprite::stop()
{
if (!m_running)
return;
m_running = false;
if (!isComponentComplete())
return;
m_pauseOffset = 0;
emit runningChanged(false);
}

View File

@ -250,7 +250,8 @@ public slots:
if (m_sprite->m_frameSync != arg) {
m_sprite->setFrameSync(arg);
emit frameSyncChanged(arg);
restart();
if (m_running)
restart();
}
}
@ -304,7 +305,8 @@ public slots:
if (m_sprite->m_frameRate != arg) {
m_sprite->setFrameRate(arg);
emit frameRateChanged(arg);
restart();
if (m_running)
restart();
}
}
@ -313,7 +315,8 @@ public slots:
if (m_sprite->m_frameDuration != arg) {
m_sprite->setFrameDuration(arg);
emit frameDurationChanged(arg);
restart();
if (m_running)
restart();
}
}

View File

@ -11,4 +11,3 @@ TESTDATA = data/*
CONFIG += parallel_test
QT += core-private gui-private qml-private quick-private network testlib
CONFIG += insignificant_test