summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>2011-02-21 09:25:57 (GMT)
committerQt Commercial Integration <QtCommercial@digia.com>2012-01-31 10:24:46 (GMT)
commit8a3466bb2eb9d66a27b80360f080d3aec489b2d8 (patch)
tree9bb7ee65f34b7852a30851ed75bd13b8696ad2a0 /src/gui/widgets
parent48138e019036f5bd65e16557ad2a9414292b850d (diff)
downloadQt-8a3466bb2eb9d66a27b80360f080d3aec489b2d8.zip
Qt-8a3466bb2eb9d66a27b80360f080d3aec489b2d8.tar.gz
Qt-8a3466bb2eb9d66a27b80360f080d3aec489b2d8.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.cpp8
1 files changed, 8 insertions, 0 deletions
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;
}