summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2022-01-10 23:01:18 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-01-13 15:00:36 +0000
commit69a5a213ddbe8b0062715d6c01b6a643e46c900a (patch)
tree0cc617faa0b87067ed0c24193a6bb0a6c326ec97
parent6361ff019ffe2dd5e7370c6eff6dd6cd852749e5 (diff)
Fix not working web ui popup (html comboboxes) due to focus out events
Recent change in qtdeclarative 42d411e2e8 causes a focus out event being delivered in case of popups to "root" item of quickwidget. This is not expected as events are forwarded to parent "view" and loosing a focus will hint Blink to trigger a pop up close request. As a communication with a render process is asynchronous this creates several race conditions in our tests and the Blink's popup close request can close unexpectedly windows creating dangling pointers. Moreover, the focus in never gained back leaving the Blink's logic in a limbo state. Simply ignore a focus out event in case of popups. Fixes: QTBUG-99215 Change-Id: I5ca6eda227101d4f19f15735e41f066cfd8ccea0 Reviewed-by: Kirill Burtsev <kirill.burtsev@qt.io> (cherry picked from commit ba2e26f3d94f0a4bb0077bed19f2b04a7b5104f0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
index aa136b662..4fa0667b8 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
@@ -76,11 +76,16 @@ protected:
}
void focusInEvent(QFocusEvent *event) override
{
+ Q_ASSERT(event->reason() != Qt::PopupFocusReason);
m_client->forwardEvent(event);
}
void focusOutEvent(QFocusEvent *event) override
{
- m_client->forwardEvent(event);
+ // The keyboard events are supposed to go to the parent RenderHostView and WebUI
+ // popups should never have focus, therefore ignore focusOutEvent as losing focus
+ // will trigger pop close request from blink
+ if (event->reason() != Qt::PopupFocusReason)
+ m_client->forwardEvent(event);
}
void inputMethodEvent(QInputMethodEvent *event) override
{