aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickimagebase.cpp
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@live.com>2014-12-06 10:38:34 -0600
committerSimon Hausmann <simon.hausmann@digia.com>2014-12-08 16:28:25 +0100
commit7568922fa240e6e9440e9c6e93bf8ec00c06ec17 (patch)
treeb14dcf1f414c501097631c7e2373cd886b5d4aff /src/quick/items/qquickimagebase.cpp
parent6a0145dd664ab9f5e3703ab3d0f962b3f378d6c6 (diff)
Avoid string-based connect in QQuickImageBase.
String-based connect is relatively slow, and should be avoided in core items. This improves performance of the tst_librarymetrics_performance::instantiation_cached(043) image - empty test case (approximately halving the time). Task-number: QTBUG-43096 Change-Id: I02485c515435eceacc95c55f877fc8566e7406d7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/quick/items/qquickimagebase.cpp')
-rw-r--r--src/quick/items/qquickimagebase.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/quick/items/qquickimagebase.cpp b/src/quick/items/qquickimagebase.cpp
index 1a5d115a3c..a4c4af4e45 100644
--- a/src/quick/items/qquickimagebase.cpp
+++ b/src/quick/items/qquickimagebase.cpp
@@ -35,6 +35,7 @@
#include "qquickimagebase_p_p.h"
#include <QtGui/qguiapplication.h>
+#include <QtGui/qscreen.h>
#include <QtQml/qqmlinfo.h>
#include <QtQml/qqmlfile.h>
@@ -45,14 +46,12 @@ QQuickImageBase::QQuickImageBase(QQuickItem *parent)
: QQuickImplicitSizeItem(*(new QQuickImageBasePrivate), parent)
{
setFlag(ItemHasContents);
- connect(this, SIGNAL(windowChanged(QQuickWindow*)), SLOT(handleWindowChanged(QQuickWindow*)));
}
QQuickImageBase::QQuickImageBase(QQuickImageBasePrivate &dd, QQuickItem *parent)
: QQuickImplicitSizeItem(dd, parent)
{
setFlag(ItemHasContents);
- connect(this, SIGNAL(windowChanged(QQuickWindow*)), SLOT(handleWindowChanged(QQuickWindow*)));
}
QQuickImageBase::~QQuickImageBase()
@@ -278,10 +277,11 @@ void QQuickImageBase::requestProgress(qint64 received, qint64 total)
}
}
-void QQuickImageBase::handleWindowChanged(QQuickWindow* window)
+void QQuickImageBase::itemChange(ItemChange change, const ItemChangeData &value)
{
- if (window)
- connect(window, SIGNAL(screenChanged(QScreen*)), this, SLOT(handleScreenChanged(QScreen*)));
+ if (change == ItemSceneChange && value.window)
+ connect(value.window, &QQuickWindow::screenChanged, this, &QQuickImageBase::handleScreenChanged);
+ QQuickItem::itemChange(change, value);
}
void QQuickImageBase::handleScreenChanged(QScreen* screen)