summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsimagebase.cpp23
-rw-r--r--src/declarative/util/qmlpixmapcache.cpp17
2 files changed, 35 insertions, 5 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp b/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp
index 9dd9f1b..e3b98aa 100644
--- a/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp
@@ -116,9 +116,26 @@ void QmlGraphicsImageBase::setSource(const QUrl &url)
if (status != QmlPixmapReply::Ready && status != QmlPixmapReply::Error) {
QmlPixmapReply *reply = QmlPixmapCache::request(qmlEngine(this), d->url);
d->pendingPixmapCache = true;
- connect(reply, SIGNAL(finished()), this, SLOT(requestFinished()));
- connect(reply, SIGNAL(downloadProgress(qint64,qint64)),
- this, SLOT(requestProgress(qint64,qint64)));
+
+ static int replyDownloadProgress = -1;
+ static int replyFinished = -1;
+ static int thisRequestProgress = -1;
+ static int thisRequestFinished = -1;
+ if (replyDownloadProgress == -1) {
+ replyDownloadProgress =
+ QmlPixmapReply::staticMetaObject.indexOfSignal("downloadProgress(qint64,qint64)");
+ replyFinished =
+ QmlPixmapReply::staticMetaObject.indexOfSignal("finished()");
+ thisRequestProgress =
+ QmlGraphicsImageBase::staticMetaObject.indexOfSlot("requestProgress(qint64,qint64)");
+ thisRequestFinished =
+ QmlGraphicsImageBase::staticMetaObject.indexOfSlot("requestFinished()");
+ }
+
+ QMetaObject::connect(reply, replyFinished, this,
+ thisRequestFinished, Qt::DirectConnection);
+ QMetaObject::connect(reply, replyDownloadProgress, this,
+ thisRequestProgress, Qt::DirectConnection);
} else {
//### should be unified with requestFinished
if (status == QmlPixmapReply::Ready) {
diff --git a/src/declarative/util/qmlpixmapcache.cpp b/src/declarative/util/qmlpixmapcache.cpp
index 475a21e..3307ff8 100644
--- a/src/declarative/util/qmlpixmapcache.cpp
+++ b/src/declarative/util/qmlpixmapcache.cpp
@@ -240,8 +240,21 @@ QmlPixmapReply::QmlPixmapReply(const QString &key, QNetworkReply *reply)
: QObject(*new QmlPixmapReplyPrivate(key, reply), 0)
{
Q_D(QmlPixmapReply);
- connect(d->reply, SIGNAL(downloadProgress(qint64,qint64)), this, SIGNAL(downloadProgress(qint64,qint64)));
- connect(d->reply, SIGNAL(finished()), this, SLOT(networkRequestDone()));
+
+ static int replyDownloadProgress = -1;
+ static int replyFinished = -1;
+ static int thisDownloadProgress = -1;
+ static int thisNetworkRequestDone = -1;
+
+ if (replyDownloadProgress == -1) {
+ replyDownloadProgress = QNetworkReply::staticMetaObject.indexOfSignal("downloadProgress(qint64,qint64)");
+ replyFinished = QNetworkReply::staticMetaObject.indexOfSignal("finished()");
+ thisDownloadProgress = QmlPixmapReply::staticMetaObject.indexOfSignal("downloadProgress(qint64,qint64)");
+ thisNetworkRequestDone = QmlPixmapReply::staticMetaObject.indexOfSlot("networkRequestDone()");
+ }
+
+ QMetaObject::connect(d->reply, replyDownloadProgress, this, thisDownloadProgress, Qt::DirectConnection);
+ QMetaObject::connect(d->reply, replyFinished, this, thisNetworkRequestDone);
}
QmlPixmapReply::~QmlPixmapReply()