diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2021-07-14 00:50:29 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2021-07-17 02:23:17 +0200 |
commit | 0e7212460ba7fab19a47f960b09a011973a7c475 (patch) | |
tree | 6801ba8a3e6e43c1a924411b965248e6f7bc2f8a /src/gui | |
parent | 8ebd4a1da820cff0e499258f79a3fc139ea06b77 (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.
Pick-to: 6.2
Change-Id: I17530b7e89939cfc19ab8ffaa076b7129ae02dcf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
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 f41c37c771..c93e483438 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -4203,8 +4203,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; @@ -4215,7 +4214,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); |