Fix QComboBox supressing a QDialogs default button

Commit 64ffe0a broke pressing RETURN aka. the default key in a dialog
to close it, when a read-only QComboBox has the focus.

Before that patch, Enter + Return were actively ignore()d, but this
code path was removed, resulting in those keys to be auto-accepted.

Fixes: QTBUG-107262
Pick-to: 6.4
Change-Id: I3dd8dca7d2f9d94f5172adc92ef508fe81c0df57
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Robert Griebl 2022-10-06 14:45:23 +02:00
parent 3d6f5e95f0
commit f7e2984a1a

View File

@ -3212,6 +3212,8 @@ void QComboBox::keyPressEvent(QKeyEvent *e)
return;
}
break;
case Qt::Key_Enter:
case Qt::Key_Return:
case Qt::Key_Escape:
if (!d->lineEdit)
e->ignore();