From de63bbd2f806b0219a60775017899cedb121581f Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 9 Nov 2016 17:33:00 +0300 Subject: [PATCH] Add QPlatformTheme::standardButtonShortcut() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It allows to set shortcuts for the standard buttons in QDialogButtonBox. Restore Qt4's behavior for the "Don't Save" button on macOS by setting a shortcut for it (it was Cmd-D before Lion, now it's Cmd-Delete). Change-Id: I6b56f68f37670962178693a8983d9fe550540856 Reviewed-by: Tor Arne Vestbø --- src/widgets/widgets/qdialogbuttonbox.cpp | 7 +------ 5 files changed, 22 insertions(+), 6 deletions(-) Index: qtbase-opensource-src-5.9.0/src/widgets/widgets/qdialogbuttonbox.cpp =================================================================== --- qtbase-opensource-src-5.9.0.orig/src/widgets/widgets/qdialogbuttonbox.cpp +++ qtbase-opensource-src-5.9.0/src/widgets/widgets/qdialogbuttonbox.cpp @@ -410,9 +410,7 @@ QPushButton *QDialogButtonBoxPrivate::cr qWarning("QDialogButtonBox::createButton: Invalid ButtonRole, button not added"); else addButton(button, static_cast(role), doLayout); -#if QT_CONFIG(shortcut) - button->setShortcut(QGuiApplicationPrivate::platformTheme()->standardButtonShortcut(sbutton)); -#endif + return button; }