diff options
author | Volker Krause <vkrause@kde.org> | 2018-07-16 20:01:43 +0200 |
---|---|---|
committer | Volker Krause <volker.krause@kdab.com> | 2018-07-18 07:32:16 +0000 |
commit | 389a90870d975404536bdabfba791ad89b2a4a0e (patch) | |
tree | 96651bcf7ae7a7a3f0202eecb4c2da1b15265e9d /src/quick/items | |
parent | 3d9a59b4329cd6f4af6f5e65bc59f8ff28180eec (diff) |
Port to qmlobject_connect
These objects can exist in larger quantities in QML applications, and due
to the large amount of connections here the allocations of the involved
string operations actually become relevant. qmlobject_connect caches the
signal/slot lookup, so we pay for this only once now.
Change-Id: I13964f01f5b15dbddad4e24d5d2b4665c8c6ae6d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/quick/items')
-rw-r--r-- | src/quick/items/qquickscreen.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp index aea7e44a65..b057fd9d8f 100644 --- a/src/quick/items/qquickscreen.cpp +++ b/src/quick/items/qquickscreen.cpp @@ -396,24 +396,24 @@ void QQuickScreenInfo::setWrappedScreen(QScreen *screen) if (!oldScreen || screen->devicePixelRatio() != oldScreen->devicePixelRatio()) emit devicePixelRatioChanged(); - connect(screen, SIGNAL(geometryChanged(QRect)), - this, SIGNAL(widthChanged())); - connect(screen, SIGNAL(geometryChanged(QRect)), - this, SIGNAL(heightChanged())); - connect(screen, SIGNAL(geometryChanged(QRect)), - this, SIGNAL(virtualXChanged())); - connect(screen, SIGNAL(geometryChanged(QRect)), - this, SIGNAL(virtualYChanged())); - connect(screen, SIGNAL(orientationChanged(Qt::ScreenOrientation)), - this, SIGNAL(orientationChanged())); - connect(screen, SIGNAL(primaryOrientationChanged(Qt::ScreenOrientation)), - this, SIGNAL(primaryOrientationChanged())); - connect(screen, SIGNAL(virtualGeometryChanged(QRect)), - this, SIGNAL(desktopGeometryChanged())); - connect(screen, SIGNAL(logicalDotsPerInchChanged(qreal)), - this, SIGNAL(logicalPixelDensityChanged())); - connect(screen, SIGNAL(physicalDotsPerInchChanged(qreal)), - this, SIGNAL(pixelDensityChanged())); + qmlobject_connect(screen, QScreen, SIGNAL(geometryChanged(QRect)), + this, QQuickScreenInfo, SIGNAL(widthChanged())); + qmlobject_connect(screen, QScreen, SIGNAL(geometryChanged(QRect)), + this, QQuickScreenInfo, SIGNAL(heightChanged())); + qmlobject_connect(screen, QScreen, SIGNAL(geometryChanged(QRect)), + this, QQuickScreenInfo, SIGNAL(virtualXChanged())); + qmlobject_connect(screen, QScreen, SIGNAL(geometryChanged(QRect)), + this, QQuickScreenInfo, SIGNAL(virtualYChanged())); + qmlobject_connect(screen, QScreen, SIGNAL(orientationChanged(Qt::ScreenOrientation)), + this, QQuickScreenInfo, SIGNAL(orientationChanged())); + qmlobject_connect(screen, QScreen, SIGNAL(primaryOrientationChanged(Qt::ScreenOrientation)), + this, QQuickScreenInfo, SIGNAL(primaryOrientationChanged())); + qmlobject_connect(screen, QScreen, SIGNAL(virtualGeometryChanged(QRect)), + this, QQuickScreenInfo, SIGNAL(desktopGeometryChanged())); + qmlobject_connect(screen, QScreen, SIGNAL(logicalDotsPerInchChanged(qreal)), + this, QQuickScreenInfo, SIGNAL(logicalPixelDensityChanged())); + qmlobject_connect(screen, QScreen, SIGNAL(physicalDotsPerInchChanged(qreal)), + this, QQuickScreenInfo, SIGNAL(pixelDensityChanged())); } QScreen *QQuickScreenInfo::wrappedScreen() const @@ -473,11 +473,11 @@ int QQuickScreenAttached::angleBetween(int a, int b) void QQuickScreenAttached::windowChanged(QQuickWindow* c) { if (m_window) - disconnect(m_window, SIGNAL(screenChanged(QScreen*)), this, SLOT(screenChanged(QScreen*))); + qmlobject_disconnect(m_window, QQuickWindow, SIGNAL(screenChanged(QScreen*)), this, QQuickScreenAttached, SLOT(screenChanged(QScreen*))); m_window = c; screenChanged(c ? c->screen() : nullptr); if (c) - connect(c, SIGNAL(screenChanged(QScreen*)), this, SLOT(screenChanged(QScreen*))); + qmlobject_connect(c, QQuickWindow, SIGNAL(screenChanged(QScreen*)), this, QQuickScreenAttached, SLOT(screenChanged(QScreen*))); } void QQuickScreenAttached::screenChanged(QScreen *screen) |