diff options
author | Noah Davis <noahadvs@gmail.com> | 2022-02-09 10:29:33 -0500 |
---|---|---|
committer | Noah Davis <noahadvs@gmail.com> | 2022-02-16 15:10:00 -0500 |
commit | 97eeded5fc8c8ebb476ed4a10d8726dd4d46f181 (patch) | |
tree | 62ac845b2693959abe8e9531ef5c310e43e291ef /src/gui | |
parent | 9beca767863739b4eccd642aeff296e2138032af (diff) |
QPA: add ButtonPressKeys ThemeHint
Platforms should allow more than just Qt::Key_Space and Qt::Key_Select
to press buttons. KDE Plasma developers want to be able to press buttons
with Return/Enter. GTK allows buttons to be pressed with Return/Enter,
so this should be considered the native behavior for GNOME as well.
Adding this ThemeHint allows customizing the keys that can press a
button via a QPlatformTheme subclass.
Change-Id: I73284e9b73590fbdd0b94a0cb4557e94b3722af9
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qplatformtheme.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qplatformtheme.h | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp index 01a5e2c806..a675ff1dc5 100644 --- a/src/gui/kernel/qplatformtheme.cpp +++ b/src/gui/kernel/qplatformtheme.cpp @@ -175,6 +175,8 @@ QT_BEGIN_NAMESPACE should be automatically selected when a file dialog opens. This enum value was added in Qt 6.3. + \value ButtonPressKeys (QList<Qt::Key>) A list of keys that can be used to press buttons via keyboard input. + \sa themeHint(), QStyle::pixelMetric() */ @@ -586,6 +588,8 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint) return true; case PreselectFirstFileInDirectory: return false; + case ButtonPressKeys: + return QVariant::fromValue(QList<Qt::Key>({ Qt::Key_Space, Qt::Key_Select })); } return QVariant(); } diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h index a6b3709548..398ea2eae1 100644 --- a/src/gui/kernel/qplatformtheme.h +++ b/src/gui/kernel/qplatformtheme.h @@ -123,6 +123,7 @@ public: InteractiveResizeAcrossScreens, ShowDirectoriesFirst, PreselectFirstFileInDirectory, + ButtonPressKeys }; Q_ENUM(ThemeHint) |