--- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp Fri Sep 17 08:34:18 2010 +0300
+++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp Mon Oct 04 01:19:32 2010 +0300
@@ -50,13 +50,6 @@
QT_BEGIN_NAMESPACE
-
-/*!
- \class QDeclarativeImageBase
- \internal
- \brief The base class for declarative images.
- */
-
QDeclarativeImageBase::QDeclarativeImageBase(QDeclarativeImageBasePrivate &dd, QDeclarativeItem *parent)
: QDeclarativeItem(dd, parent)
{
@@ -150,7 +143,9 @@
pixmapChange();
update();
} else {
+
d->status = Loading;
+ emit statusChanged(d->status);
d->pix.load(qmlEngine(this), d->url, d->sourcesize, d->async);
@@ -169,53 +164,35 @@
d->pix.connectDownloadProgress(this, thisRequestProgress);
} else {
- QSize impsize = d->pix.implicitSize();
- setImplicitWidth(impsize.width());
- setImplicitHeight(impsize.height());
-
- if (d->pix.isReady()) {
- d->status = Ready;
-
- if (!d->sourcesize.isValid())
- emit sourceSizeChanged();
-
- } else {
- d->status = Error;
- qmlInfo(this) << d->pix.error();
- }
- d->progress = 1.0;
- emit statusChanged(d->status);
- emit progressChanged(d->progress);
- pixmapChange();
- update();
+ requestFinished();
}
-
}
-
- emit statusChanged(d->status);
}
void QDeclarativeImageBase::requestFinished()
{
Q_D(QDeclarativeImageBase);
- QSize impsize = d->pix.implicitSize();
-
if (d->pix.isError()) {
d->status = Error;
qmlInfo(this) << d->pix.error();
+ } else {
+ d->status = Ready;
}
- setImplicitWidth(impsize.width());
- setImplicitHeight(impsize.height());
+ d->progress = 1.0;
+
+ setImplicitWidth(d->pix.width());
+ setImplicitHeight(d->pix.height());
- if (d->status == Loading)
- d->status = Ready;
- d->progress = 1.0;
+ if (d->sourcesize.width() != d->pix.width() || d->sourcesize.height() != d->pix.height()) {
+ d->sourcesize.setWidth(d->pix.width());
+ d->sourcesize.setHeight(d->pix.height());
+ emit sourceSizeChanged();
+ }
+
emit statusChanged(d->status);
- emit progressChanged(1.0);
- if (!d->sourcesize.isValid())
- emit sourceSizeChanged();
+ emit progressChanged(d->progress);
pixmapChange();
update();
}