summaryrefslogtreecommitdiffstats
path: root/src/declarative/extra/qmlgraphicsanimatedimageitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/extra/qmlgraphicsanimatedimageitem.cpp')
-rw-r--r--src/declarative/extra/qmlgraphicsanimatedimageitem.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/declarative/extra/qmlgraphicsanimatedimageitem.cpp b/src/declarative/extra/qmlgraphicsanimatedimageitem.cpp
index f3c2058..2405bde 100644
--- a/src/declarative/extra/qmlgraphicsanimatedimageitem.cpp
+++ b/src/declarative/extra/qmlgraphicsanimatedimageitem.cpp
@@ -76,7 +76,7 @@ Item {
\endqml
\endtable
*/
-QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,AnimatedImage,QmlGraphicsAnimatedImageItem)
+QML_DEFINE_TYPE(Qt,4,6,AnimatedImage,QmlGraphicsAnimatedImageItem)
QmlGraphicsAnimatedImageItem::QmlGraphicsAnimatedImageItem(QmlGraphicsItem *parent)
: QmlGraphicsImage(*(new QmlGraphicsAnimatedImageItemPrivate), parent)
@@ -158,15 +158,17 @@ int QmlGraphicsAnimatedImageItem::currentFrame() const
{
Q_D(const QmlGraphicsAnimatedImageItem);
if (!d->_movie)
- return -1;
+ return d->preset_currentframe;
return d->_movie->currentFrameNumber();
}
void QmlGraphicsAnimatedImageItem::setCurrentFrame(int frame)
{
Q_D(QmlGraphicsAnimatedImageItem);
- if (!d->_movie)
+ if (!d->_movie) {
+ d->preset_currentframe = frame;
return;
+ }
d->_movie->jumpToFrame(frame);
}
@@ -264,8 +266,10 @@ void QmlGraphicsAnimatedImageItem::movieRequestFinished()
d->_movie->setCacheMode(QMovie::CacheAll);
if(d->playing)
d->_movie->start();
- else
- d->_movie->jumpToFrame(0);
+ else {
+ d->_movie->jumpToFrame(d->preset_currentframe);
+ d->preset_currentframe = 0;
+ }
if(d->paused)
d->_movie->setPaused(true);
d->setPixmap(d->_movie->currentPixmap());
@@ -291,4 +295,11 @@ void QmlGraphicsAnimatedImageItem::playingStatusChanged()
}
}
+void QmlGraphicsAnimatedImageItem::componentComplete()
+{
+ Q_D(QmlGraphicsAnimatedImageItem);
+ setCurrentFrame(d->preset_currentframe);
+ d->preset_currentframe = 0;
+}
+
QT_END_NAMESPACE