From 43caaca740dd217c13764658d4c286c0d83381e4 Mon Sep 17 00:00:00 2001 From: Noah Davis Date: Wed, 16 Feb 2022 08:50:08 -0500 Subject: [PATCH] QGnomeTheme: Allow Space, Return, Enter and Select to press buttons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GTK buttons can be pressed with Space, Return and Enter, so this should be considered native behavior for GTK based desktop environments. Qt::Key_Select is also included here because QAbstractButton has been pressable with Qt::Key_Select for a long time. Change-Id: I2c279ad05d1a10e5968a18996b8b40a83d2251fa Reviewed-by: Tor Arne Vestbø --- src/gui/platform/unix/qgenericunixthemes.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/platform/unix/qgenericunixthemes.cpp b/src/gui/platform/unix/qgenericunixthemes.cpp index 86f2a266ea..1a564a5360 100644 --- a/src/gui/platform/unix/qgenericunixthemes.cpp +++ b/src/gui/platform/unix/qgenericunixthemes.cpp @@ -733,6 +733,7 @@ QGnomeTheme::QGnomeTheme() QVariant QGnomeTheme::themeHint(QPlatformTheme::ThemeHint hint) const { + Q_D(const QGnomeTheme); switch (hint) { case QPlatformTheme::DialogButtonBoxButtonsHaveIcons: return QVariant(true); @@ -757,6 +758,9 @@ QVariant QGnomeTheme::themeHint(QPlatformTheme::ThemeHint hint) const return QVariant(QChar(0x2022)); case QPlatformTheme::UiEffects: return QVariant(int(HoverEffect)); + case QPlatformTheme::ButtonPressKeys: + return QVariant::fromValue( + QList({ Qt::Key_Space, Qt::Key_Return, Qt::Key_Enter, Qt::Key_Select })); default: break; }