diff options
author | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2011-02-21 09:25:57 (GMT) |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2011-02-21 09:25:57 (GMT) |
commit | 73ae8a593b96ead99dabb854b20a687aa849b71b (patch) | |
tree | 9e0488855893601535563b0a86719430af64ebf1 /src/gui/widgets | |
parent | 45f8d9f78c8357c087a71346e0815c23997d67b4 (diff) | |
download | Qt-73ae8a593b96ead99dabb854b20a687aa849b71b.zip Qt-73ae8a593b96ead99dabb854b20a687aa849b71b.tar.gz Qt-73ae8a593b96ead99dabb854b20a687aa849b71b.tar.bz2 |
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
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/qdialogbuttonbox.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
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; } |