From 184d80f5a0d6764745ab77487620eb41679226f0 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Wed, 21 Jun 2017 10:49:59 +0200 Subject: QDialogButtonBox: Don't overwrite shortcut with standardButtonShortcut MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit de63bbd2f806b0219a60775017899cedb121581f 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 Reviewed-by: Alexander Volkov Reviewed-by: Tor Arne Vestbø --- src/widgets/widgets/qdialogbuttonbox.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp index a3e55114bb..90cb17da59 100644 --- a/src/widgets/widgets/qdialogbuttonbox.cpp +++ b/src/widgets/widgets/qdialogbuttonbox.cpp @@ -411,7 +411,9 @@ QPushButton *QDialogButtonBoxPrivate::createButton(QDialogButtonBox::StandardBut else addButton(button, static_cast(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; } -- cgit v1.2.3