diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2021-07-14 00:50:29 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-07-17 02:52:02 +0000 |
commit | 4a373f7a74715985993da8c0f2453afbdd44e126 (patch) | |
tree | 6a93f85e473bf99f9e0b877474b09cf0468c46df /src/gui | |
parent | 7adddb1664266c580a9490e8ad86dc2df2af3cea (diff) |
Use member function instead of template function to resolve native interface
The use of a freestanding function is not needed now that the name
doesn't alias the nativeInterface accessor function, and was just
adding complexity to the machinery.
People not familiar with the code will have an easier time following
the flow through the helper member function, and we no longer need
to declare our own export macros.
Change-Id: I17530b7e89939cfc19ab8ffaa076b7129ae02dcf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 0e7212460ba7fab19a47f960b09a011973a7c475)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 5 | ||||
-rw-r--r-- | src/gui/kernel/qkeymapper.cpp | 5 | ||||
-rw-r--r-- | src/gui/kernel/qoffscreensurface.cpp | 11 | ||||
-rw-r--r-- | src/gui/kernel/qopenglcontext.cpp | 7 | ||||
-rw-r--r-- | src/gui/kernel/qscreen.cpp | 6 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 5 |
6 files changed, 16 insertions, 23 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index b6477e91ec..c8316e04e2 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -4207,8 +4207,7 @@ QInputDeviceManager *QGuiApplicationPrivate::inputDeviceManager() return m_inputDeviceManager; } -template <> -Q_NATIVE_INTERFACE_EXPORT void *QNativeInterface::Private::resolveInterface(const QGuiApplication *that, const char *name, int revision) +void *QGuiApplication::resolveInterface(const char *name, int revision) const { using namespace QNativeInterface::Private; @@ -4219,7 +4218,7 @@ Q_NATIVE_INTERFACE_EXPORT void *QNativeInterface::Private::resolveInterface(cons QT_NATIVE_INTERFACE_RETURN_IF(QWindowsApplication, platformIntegration); #endif - return resolveInterface<QCoreApplication>(that, name, revision); + return QCoreApplication::resolveInterface(name, revision); } #include "moc_qguiapplication.cpp" diff --git a/src/gui/kernel/qkeymapper.cpp b/src/gui/kernel/qkeymapper.cpp index e3d39f80dc..054d850dbb 100644 --- a/src/gui/kernel/qkeymapper.cpp +++ b/src/gui/kernel/qkeymapper.cpp @@ -135,10 +135,9 @@ QList<int> QKeyMapperPrivate::possibleKeys(QKeyEvent *e) return extractKeyFromEvent(e); } -template <> -Q_NATIVE_INTERFACE_EXPORT void *QNativeInterface::Private::resolveInterface(const QKeyMapper *that, const char *name, int revision) +void *QKeyMapper::resolveInterface(const char *name, int revision) const { - Q_UNUSED(that); Q_UNUSED(name); Q_UNUSED(revision); + Q_UNUSED(name); Q_UNUSED(revision); using namespace QNativeInterface::Private; #if QT_CONFIG(evdev) diff --git a/src/gui/kernel/qoffscreensurface.cpp b/src/gui/kernel/qoffscreensurface.cpp index 7cb8050504..8fbb188bd1 100644 --- a/src/gui/kernel/qoffscreensurface.cpp +++ b/src/gui/kernel/qoffscreensurface.cpp @@ -371,16 +371,15 @@ QPlatformSurface *QOffscreenSurface::surfaceHandle() const using namespace QNativeInterface; -template <> -Q_NATIVE_INTERFACE_EXPORT void *QNativeInterface::Private::resolveInterface(const QOffscreenSurface *that, const char *name, int revision) +void *QOffscreenSurface::resolveInterface(const char *name, int revision) const { - Q_UNUSED(that); Q_UNUSED(name); Q_UNUSED(revision); + Q_UNUSED(name); Q_UNUSED(revision); - auto *surfacePrivate = QOffscreenSurfacePrivate::get(const_cast<QOffscreenSurface*>(that)); - Q_UNUSED(surfacePrivate); + Q_D(const QOffscreenSurface); + Q_UNUSED(d); #if defined(Q_OS_ANDROID) - QT_NATIVE_INTERFACE_RETURN_IF(QAndroidOffscreenSurface, surfacePrivate->platformOffscreenSurface); + QT_NATIVE_INTERFACE_RETURN_IF(QAndroidOffscreenSurface, d->platformOffscreenSurface); #endif return nullptr; diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index eef85bf0d0..bdbd18f771 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -1312,12 +1312,11 @@ QDebug operator<<(QDebug debug, const QOpenGLContextGroup *cg) using namespace QNativeInterface; -template <> -Q_NATIVE_INTERFACE_EXPORT void *QNativeInterface::Private::resolveInterface(const QOpenGLContext *that, const char *name, int revision) +void *QOpenGLContext::resolveInterface(const char *name, int revision) const { - Q_UNUSED(that); Q_UNUSED(name); Q_UNUSED(revision); + Q_UNUSED(name); Q_UNUSED(revision); - auto *platformContext = that->handle(); + auto *platformContext = handle(); Q_UNUSED(platformContext); #if defined(Q_OS_MACOS) diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp index 6f9f48d6c4..e6f408875e 100644 --- a/src/gui/kernel/qscreen.cpp +++ b/src/gui/kernel/qscreen.cpp @@ -785,13 +785,11 @@ QPixmap QScreen::grabWindow(WId window, int x, int y, int width, int height) result.setDevicePixelRatio(result.devicePixelRatio() * factor); return result; } - -template <> -Q_NATIVE_INTERFACE_EXPORT void *QNativeInterface::Private::resolveInterface(const QScreen *that, const char *name, int revision) +void *QScreen::resolveInterface(const char *name, int revision) const { using namespace QNativeInterface::Private; - auto *platformScreen = that->handle(); + auto *platformScreen = handle(); Q_UNUSED(platformScreen); Q_UNUSED(name); Q_UNUSED(revision); diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 61c201559a..7f6e5044cb 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -3004,12 +3004,11 @@ bool QWindowPrivate::applyCursor() } #endif // QT_NO_CURSOR -template <> -Q_NATIVE_INTERFACE_EXPORT void *QNativeInterface::Private::resolveInterface(const QWindow *that, const char *name, int revision) +void *QWindow::resolveInterface(const char *name, int revision) const { using namespace QNativeInterface::Private; - auto *platformWindow = that->handle(); + auto *platformWindow = handle(); Q_UNUSED(platformWindow); Q_UNUSED(name); Q_UNUSED(revision); |