summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimagebase.cpp23
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimagebase_p.h3
2 files changed, 14 insertions, 12 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();
}
diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h
index f5896b1..68eb8d0 100644
--- a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h
@@ -58,7 +58,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeImageBase : public QDeclarativeItem
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged)
Q_PROPERTY(bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged)
-
Q_PROPERTY(QSize sourceSize READ sourceSize WRITE setSourceSize NOTIFY sourceSizeChanged)
public:
@@ -79,7 +78,7 @@ public:
Q_SIGNALS:
void sourceChanged(const QUrl &);
void sourceSizeChanged();
- void statusChanged(Status);
+ void statusChanged(QDeclarativeImageBase::Status);
void progressChanged(qreal progress);
void asynchronousChanged();