From 1ffd12a8dc783b8e0806b839a3015b4fb9298bad Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Tue, 21 Nov 2023 18:50:28 +0100 Subject: QComboBox: don't eat non-printable key strokes QComboBox in non-editable mode passes all keyboard input to the internal item search. This was done regardless if the character is printable or not and therefore e.g. '\t' composed by Key_Tab + ControlModifier was accepted and not passed to the parent (in the bug report to the QTabWidget which could not switch tabs due to that). Pick-to: 6.6 6.5 Fixes: QTBUG-118605 Change-Id: If39423587460a70231c735df4912b72c5ae77475 Reviewed-by: Volker Hilsheimer --- src/widgets/widgets/qcombobox.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/widgets/widgets/qcombobox.cpp') diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 50b81b8e94..2e60d1f552 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -3315,8 +3315,9 @@ void QComboBox::keyPressEvent(QKeyEvent *e) #endif if (!d->lineEdit) { - if (!e->text().isEmpty()) - d->keyboardSearchString(e->text()); + const auto text = e->text(); + if (!text.isEmpty() && text.at(0).isPrint()) + d->keyboardSearchString(text); else e->ignore(); } -- cgit v1.2.3