diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-12-21 08:04:14 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-12-21 08:04:14 (GMT) |
commit | 0a4ab50b6ed19a2d3fbe7b1f9d9614ad5d9b339e (patch) | |
tree | 0cb3d3086c5f2b7c37e28fd2b6b18b14ba5c77f4 /src/declarative/graphicsitems/qmlgraphicsimagebase.cpp | |
parent | 178a508040bd43320a19ec2ae3250278d7b133bc (diff) | |
download | Qt-0a4ab50b6ed19a2d3fbe7b1f9d9614ad5d9b339e.zip Qt-0a4ab50b6ed19a2d3fbe7b1f9d9614ad5d9b339e.tar.gz Qt-0a4ab50b6ed19a2d3fbe7b1f9d9614ad5d9b339e.tar.bz2 |
Optimization: signal connections
Diffstat (limited to 'src/declarative/graphicsitems/qmlgraphicsimagebase.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsimagebase.cpp | 23 |
1 files changed, 20 insertions, 3 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) { |