diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-09-20 23:35:13 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-10-06 15:48:45 +0200 |
commit | c74cfae7a3a8f446415a483846c74092189af31d (patch) | |
tree | 01427fd7d3d94edd4421af583ea9c9efbf454409 /src/gui/kernel/qplatformintegration.cpp | |
parent | d9bb8c0a1702ed345ddacdc0179a43d1dc4722a7 (diff) |
Long live QPlatformKeyMapper!
The QKeyMapper class never got a platform integration companion.
As we might be adding more functionality here in the future, let's
fix that now, instead of adding more hooks directly to the platform
integration class.
The QKeyMapper will soon update its possibleKeys signature to
return QKeyCombination, but for now transform the result.
Change-Id: I88ef498180b2a8a7937a74627b7eb6b5156e872a
Reviewed-by: Liang Qi <liang.qi@qt.io>
Diffstat (limited to 'src/gui/kernel/qplatformintegration.cpp')
-rw-r--r-- | src/gui/kernel/qplatformintegration.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index b7117b121d..3b20d2e7e4 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -6,6 +6,7 @@ #include <qpa/qplatformfontdatabase.h> #include <qpa/qplatformclipboard.h> #include <qpa/qplatformaccessibility.h> +#include <qpa/qplatformkeymapper.h> #include <qpa/qplatformtheme.h> #include <QtGui/private/qguiapplication_p.h> #include <QtGui/private/qpixmap_raster_p.h> @@ -342,6 +343,21 @@ QPlatformInputContext *QPlatformIntegration::inputContext() const return nullptr; } +/*! + Accessor for the platform integration's key mapper. + + Default implementation returns a default QPlatformKeyMapper. + + \sa QPlatformKeyMapper +*/ +QPlatformKeyMapper *QPlatformIntegration::keyMapper() const +{ + static QPlatformKeyMapper *keyMapper = nullptr; + if (!keyMapper) + keyMapper = new QPlatformKeyMapper; + return keyMapper; +} + #if QT_CONFIG(accessibility) /*! |