diff options
Diffstat (limited to 'src/declarative/graphicsitems')
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsborderimage.cpp | 4 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsimagebase.cpp | 21 |
2 files changed, 13 insertions, 12 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp b/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp index 5b05487..6f953bc 100644 --- a/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp @@ -176,12 +176,10 @@ void QmlGraphicsBorderImage::setSource(const QUrl &url) if (url.isEmpty()) { d->pix = QPixmap(); d->status = Null; - d->progress = 1.0; setImplicitWidth(0); setImplicitHeight(0); emit statusChanged(d->status); emit sourceChanged(d->url); - emit progressChanged(1.0); update(); } else { d->status = Loading; @@ -219,7 +217,7 @@ void QmlGraphicsBorderImage::setSource(const QUrl &url) d->progress = 1.0; emit statusChanged(d->status); emit sourceChanged(d->url); - emit progressChanged(1.0); + emit progressChanged(d->progress); update(); } } diff --git a/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp b/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp index 0b57540..3e86a7c 100644 --- a/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp @@ -108,16 +108,15 @@ void QmlGraphicsImageBase::setSource(const QUrl &url) if (url.isEmpty()) { d->pix = QPixmap(); d->status = Null; - d->progress = 1.0; setImplicitWidth(0); setImplicitHeight(0); emit statusChanged(d->status); emit sourceChanged(d->url); - emit progressChanged(1.0); update(); } else { d->status = Loading; - QNetworkReply *reply = QmlPixmapCache::get(qmlEngine(this), d->url, &d->pix); + bool ok = true; + QNetworkReply *reply = QmlPixmapCache::get(qmlEngine(this), d->url, &d->pix, &ok); if (reply) { d->pendingPixmapCache = true; connect(reply, SIGNAL(finished()), this, SLOT(requestFinished())); @@ -125,15 +124,19 @@ void QmlGraphicsImageBase::setSource(const QUrl &url) this, SLOT(requestProgress(qint64,qint64))); } else { //### should be unified with requestFinished - setImplicitWidth(d->pix.width()); - setImplicitHeight(d->pix.height()); - - if (d->status == Loading) - d->status = Ready; + if (ok) { + setImplicitWidth(d->pix.width()); + setImplicitHeight(d->pix.height()); + + if (d->status == Loading) + d->status = Ready; + } else { + d->status = Error; + } d->progress = 1.0; emit statusChanged(d->status); emit sourceChanged(d->url); - emit progressChanged(1.0); + emit progressChanged(d->progress); update(); } } |