summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qcombobox.cpp
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2023-11-21 18:50:28 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2023-11-23 10:33:28 +0000
commit1ffd12a8dc783b8e0806b839a3015b4fb9298bad (patch)
tree65039784db014b9824635303a565cab07671f9e2 /src/widgets/widgets/qcombobox.cpp
parent2da43b563eeaff173ed749e9c8de23532953a01f (diff)
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 <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets/widgets/qcombobox.cpp')
-rw-r--r--src/widgets/widgets/qcombobox.cpp5
1 files changed, 3 insertions, 2 deletions
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();
}