diff options
author | Yann Bodson <yann.bodson@nokia.com> | 2010-09-08 05:17:09 (GMT) |
---|---|---|
committer | Yann Bodson <yann.bodson@nokia.com> | 2010-09-10 04:26:53 (GMT) |
commit | f11e2ef009c7e39f927c28d8d9d37b9dabf29f80 (patch) | |
tree | 3267ea4063d388dca40dee8944648710402ede27 /src/declarative | |
parent | 21a4c8f7f9ace18514f1d9fa9e203beaf6bd2844 (diff) | |
download | Qt-f11e2ef009c7e39f927c28d8d9d37b9dabf29f80.zip Qt-f11e2ef009c7e39f927c28d8d9d37b9dabf29f80.tar.gz Qt-f11e2ef009c7e39f927c28d8d9d37b9dabf29f80.tar.bz2 |
Changing the Image 'source' should not go through the 'Loading' state if the image is cached.
Task-number: QTBUG-13454
Reviewed-by: Martin Jones
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeimagebase.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp index f0293d6..02b4807 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp @@ -129,27 +129,25 @@ QSize QDeclarativeImageBase::sourceSize() const void QDeclarativeImageBase::load() { Q_D(QDeclarativeImageBase); - if (d->progress != 0.0) { - d->progress = 0.0; - emit progressChanged(d->progress); - } if (d->url.isEmpty()) { d->pix.clear(); d->status = Null; + d->progress = 0.0; setImplicitWidth(0); setImplicitHeight(0); + emit progressChanged(d->progress); emit statusChanged(d->status); pixmapChange(); update(); } else { - - d->status = Loading; - emit statusChanged(d->status); - d->pix.load(qmlEngine(this), d->url, d->sourcesize, d->async); if (d->pix.isLoading()) { + d->progress = 0.0; + d->status = Loading; + emit progressChanged(d->progress); + emit statusChanged(d->status); static int thisRequestProgress = -1; static int thisRequestFinished = -1; @@ -173,6 +171,9 @@ void QDeclarativeImageBase::requestFinished() { Q_D(QDeclarativeImageBase); + QDeclarativeImageBase::Status oldStatus = d->status; + qreal oldProgress = d->progress; + if (d->pix.isError()) { d->status = Error; qmlInfo(this) << d->pix.error(); @@ -191,8 +192,10 @@ void QDeclarativeImageBase::requestFinished() emit sourceSizeChanged(); } - emit statusChanged(d->status); - emit progressChanged(d->progress); + if (d->status != oldStatus) + emit statusChanged(d->status); + if (d->progress != oldProgress) + emit progressChanged(d->progress); pixmapChange(); update(); } |