qt5base-lts/tests/auto/widgets/util
Gabriel de Dietrich 4c025ca9c7 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>
2017-09-22 00:02:06 +00:00
..
qcompleter QCompleter: Send activated() signal only once on return key 2017-09-22 00:02:06 +00:00
qscroller autotests: use QTest::createTouchDevice() 2016-06-10 13:07:17 +00:00
qsystemtrayicon Update Widgets/Util Tests to Qt5 Connection Syntax 2016-12-22 15:00:23 +00:00
qundogroup Merge remote-tracking branch 'origin/5.8' into 5.9 2017-03-13 15:55:44 +01:00
qundostack Merge remote-tracking branch 'origin/5.8' into 5.9 2017-03-13 15:55:44 +01:00
util.pro Remove Symbian specific code from qtbase. 2012-01-31 07:08:31 +01:00