From 8a3466bb2eb9d66a27b80360f080d3aec489b2d8 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 04673a3..78d6160 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