From 73ae8a593b96ead99dabb854b20a687aa849b71b Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 21 Feb 2011 10:25:57 +0100 Subject: Mac: add support for closing dialogs using Cmd-D This is how dialogs work natively on Mac; you can choose the "Don't Save" button by using the shortcut "Cmd-D" Rev-By: jbache --- src/gui/widgets/qdialogbuttonbox.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp index 5f17a2b..6fe87b6 100644 --- a/src/gui/widgets/qdialogbuttonbox.cpp +++ b/src/gui/widgets/qdialogbuttonbox.cpp @@ -562,6 +562,14 @@ QPushButton *QDialogButtonBoxPrivate::createButton(QDialogButtonBox::StandardBut } else { qWarning("QDialogButtonBox::createButton: Invalid ButtonRole, button not added"); } + +#ifdef Q_WS_MAC + // Since mnemonics is off by default on Mac, we add a Cmd-D + // shortcut here to e.g. make the "Don't Save" button work nativly: + if (sbutton == QDialogButtonBox::Discard) + button->setShortcut(QKeySequence(QLatin1String("Ctrl+D"))); +#endif + return button; } -- cgit v0.12