diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2009-07-20 06:08:05 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2009-07-20 06:08:05 (GMT) |
commit | c0493bf1dab7bd5675e9c6a7429f595bed6f9558 (patch) | |
tree | 37ab00712aa7bdd94568b5a476f2352305fd2958 /src | |
parent | 2e4684e1004c3e5be16fb4ef21d8b2400063b241 (diff) | |
download | Qt-c0493bf1dab7bd5675e9c6a7429f595bed6f9558.zip Qt-c0493bf1dab7bd5675e9c6a7429f595bed6f9558.tar.gz Qt-c0493bf1dab7bd5675e9c6a7429f595bed6f9558.tar.bz2 |
Fix bug in AnimatedImage where it wouldn't show until played
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/extra/qfxanimatedimageitem.cpp | 12 | ||||
-rw-r--r-- | src/declarative/extra/qfxanimatedimageitem_p.h | 3 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/declarative/extra/qfxanimatedimageitem.cpp b/src/declarative/extra/qfxanimatedimageitem.cpp index d22959a..7e44abf 100644 --- a/src/declarative/extra/qfxanimatedimageitem.cpp +++ b/src/declarative/extra/qfxanimatedimageitem.cpp @@ -112,6 +112,9 @@ bool QFxAnimatedImageItem::isPlaying() const void QFxAnimatedImageItem::setPlaying(bool play) { Q_D(QFxAnimatedImageItem); + if(play == d->playing) + return; + d->playing = play; if (!d->_movie) return; if (play) @@ -166,7 +169,7 @@ void QFxAnimatedImageItem::setSource(const QUrl &url) d->reply = 0; } - d->url = url; + d->url = qmlContext(this)->resolvedUrl(url); if (url.isEmpty()) { delete d->_movie; @@ -188,7 +191,7 @@ void QFxAnimatedImageItem::movieRequestFinished() Q_D(QFxAnimatedImageItem); d->_movie = new QMovie(d->reply); if (!d->_movie->isValid()){ - qWarning() << "Error Reading File " << d->url; + qWarning() << "Error Reading Animated Image File " << d->url; delete d->_movie; d->_movie = 0; return; @@ -198,7 +201,10 @@ void QFxAnimatedImageItem::movieRequestFinished() connect(d->_movie, SIGNAL(frameChanged(int)), this, SLOT(movieUpdate())); d->_movie->setCacheMode(QMovie::CacheAll); - d->_movie->start(); + if(d->playing) + d->_movie->start(); + else + d->_movie->jumpToFrame(0); setPixmap(d->_movie->currentPixmap()); } diff --git a/src/declarative/extra/qfxanimatedimageitem_p.h b/src/declarative/extra/qfxanimatedimageitem_p.h index e7d8fb8..d743ba4 100644 --- a/src/declarative/extra/qfxanimatedimageitem_p.h +++ b/src/declarative/extra/qfxanimatedimageitem_p.h @@ -65,10 +65,11 @@ class QFxAnimatedImageItemPrivate : public QFxImagePrivate public: QFxAnimatedImageItemPrivate() - : _movie(0) + : playing(true), _movie(0) { } + bool playing; QMovie *_movie; }; |