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
Change-Id: I3dd8dca7d2f9d94f5172adc92ef508fe81c0df57
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit f7e2984a1a8ce6fbe933f3905ae79b39ff5438df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Robert Griebl 2022-10-06 14:45:23 +02:00 committed by Qt Cherry-pick Bot
parent 2ce49dfe8c
commit 789f51eabc

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();