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-14 09:25:13 +0000
commit62460e5e0f9b67ce3b2e5d0c88fab83b6eac82fb (patch)
tree7b63d03e94f254b9ac14f119e6c7956aecc1e3b0
parent8e61fce3e596a2815838305e7ae10c42ba3ae6f6 (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
{