QGnomeTheme: Allow Space, Return, Enter and Select to press buttons

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ø <tor.arne.vestbo@qt.io>
bb10
Noah Davis 2022-02-16 08:50:08 -05:00
parent 760815599b
commit 43caaca740
1 changed files with 4 additions and 0 deletions

View File

@ -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>({ Qt::Key_Space, Qt::Key_Return, Qt::Key_Enter, Qt::Key_Select }));
default:
break;
}