QDialogButtonBox: Don't overwrite shortcut with standardButtonShortcut

de63bbd2f8 introduced a new
QPlatformTheme::standardButtonShortcut which would then unconditionally
overwrite the QPushButton shortcut, even when empty, breaking activating
mnemonics potentially included in the button's text.

Task-number: QTBUG-61197
Change-Id: I2a5a460a820a5ab4054eb44f349066aaeca1436f
Reviewed-by: Marco Martin <notmart@gmail.com>
Reviewed-by: Alexander Volkov <a.volkov@rusbitech.ru>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Kai Uwe Broulik 2017-06-21 10:49:59 +02:00 committed by Tor Arne Vestbø
parent 773178900f
commit 184d80f5a0

View File

@ -411,7 +411,9 @@ QPushButton *QDialogButtonBoxPrivate::createButton(QDialogButtonBox::StandardBut
else
addButton(button, static_cast<QDialogButtonBox::ButtonRole>(role), doLayout);
#if QT_CONFIG(shortcut)
button->setShortcut(QGuiApplicationPrivate::platformTheme()->standardButtonShortcut(sbutton));
const QKeySequence standardShortcut = QGuiApplicationPrivate::platformTheme()->standardButtonShortcut(sbutton);
if (!standardShortcut.isEmpty())
button->setShortcut(standardShortcut);
#endif
return button;
}