QMessageBox: shortcuts for selectAll, copy don't conflict with buttons

You can hit a key with no modifier to select a dialog button that has
the corresponding mnemonic, but it doesn't make sense to do that if
the Control or Meta key is being held.  Now you can hit Ctrl-A, Ctrl-C
to select all the message detail text and copy it to the clipboard,
even if the dialog has buttons with mnemonics like &Continue and
Save &Again.  But as before, Alt-C, plain C, Alt-A and plain A select
the mnemonic buttons on the dialog.

Change-Id: I40c052dbb7730bde444ac2de405724a3203d1472
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Shawn Rutledge 2013-09-10 18:06:25 +02:00 committed by The Qt Project
parent b7b573ad6d
commit 96c711fed2

View File

@ -1428,7 +1428,7 @@ void QMessageBox::keyPressEvent(QKeyEvent *e)
#endif // !QT_NO_CLIPBOARD && !QT_NO_SHORTCUT
#ifndef QT_NO_SHORTCUT
if (!(e->modifiers() & Qt::AltModifier)) {
if (!(e->modifiers() & (Qt::AltModifier | Qt::ControlModifier | Qt::MetaModifier))) {
int key = e->key() & ~Qt::MODIFIER_MASK;
if (key) {
const QList<QAbstractButton *> buttons = d->buttonBox->buttons();