summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qwidgetlinecontrol.cpp
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@qt.io>2017-08-28 10:04:35 +0700
committerGabriel de Dietrich <gabriel.dedietrich@qt.io>2017-09-22 00:02:06 +0000
commit4c025ca9c73bda320f0e7577a4fbd141c31d7c8c (patch)
tree3027179d32a30a194793ee1961b2d3d3dc68ca5f /src/widgets/widgets/qwidgetlinecontrol.cpp
parentd29f0bc65c1817bb73153cd546d7ab76e0768be0 (diff)
QCompleter: Send activated() signal only once on return key
Due to the complex event forwarding logic between QCompleter, QComboBox, QLineEdit and QWidgetLineControl, in some cases the same single user return key press could result in duplicated activated() signals being emitted by QComboBox. The first one would be emitted because QLineEdit emitted editingFinished() as a result of QCompleter::eventFilter() having forwarded the return key press event to QComboBox. The second one, would happen right after, as QCompleter::eventFilter() would process the same event on behalf of its popup. (We recall that QCompleter is installed as its own popup event filter. That's also the case for the completer's widget, although the purpose there is limited to focus-out events). The current fix consists on skipping the emit as a result of QLineEdit::editingFinished() if the completer's popup is still active. For this to be accurate, it helps to test whether the completer's popup is visible, so we will not be hiding it in QWidgetLineControl::processKeyEvent() anymore. Indeed, we know that if the popup is visible, that means that processKeyEvent() was called after being forwarded by the completer's popup event filter. Furthermore, the popup will be hidden by its event filter shortly after it returns from said event forwarding call. Based on a patch by Alexey Chernov <4ernov@gmail.com>. Task-number: QTBUG-51858 Task-number: QTBUG-51889 Change-Id: I013f6c3000ae37b5b0ec20eaf5cf7746c9c903e3 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/widgets/qwidgetlinecontrol.cpp')
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp10
1 files changed, 0 insertions, 10 deletions
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
index 32944b3918..4f4a6f70b5 100644
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp
@@ -1642,16 +1642,6 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
case Qt::Key_Escape:
event->ignore();
return;
- case Qt::Key_Enter:
- case Qt::Key_Return:
- case Qt::Key_F4:
-#ifdef QT_KEYPAD_NAVIGATION
- case Qt::Key_Select:
- if (!QApplication::keypadNavigationEnabled())
- break;
-#endif
- popup->hide(); // just hide. will end up propagating to parent
- break;
default:
break; // normal key processing
}