From 2b63d0ccf3f99b3a21d02fc4804df0be385e9526 Mon Sep 17 00:00:00 2001 From: Axel Spoerl Date: Thu, 28 Sep 2023 14:02:57 +0200 Subject: [PATCH] QComboBoxPrivateContainer: add missing keyEvent->accept() Call QEvent::accept() when a key event has been acted on. This prevents redundant event delivery and consumption. Task-number: QTBUG-117644 Pick-to: 6.6 6.5 Change-Id: I069c61c14890577683894f165fd2585ba05c45ff Reviewed-by: Michael Weghorn Reviewed-by: Liang Qi --- src/widgets/widgets/qcombobox.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index c31f682f13..457af8d1ec 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -725,6 +725,7 @@ bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e) #endif if (view->currentIndex().isValid() && view->currentIndex().flags().testFlag(Qt::ItemIsEnabled)) { combo->hidePopup(); + keyEvent->accept(); emit itemSelected(view->currentIndex()); } return true; @@ -734,6 +735,8 @@ bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e) Q_FALLTHROUGH(); case Qt::Key_F4: combo->hidePopup(); + keyEvent->accept(); + emit itemSelected(view->currentIndex()); return true; default: #if QT_CONFIG(shortcut)