summaryrefslogtreecommitdiffstats
path: root/src
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 19:06:02 +0000
commit2947d79d8210a7ae4ce2bc02e058628e66011be3 (patch)
tree11afe520e1286fd6b3024a2bab07c73bb6550bad /src
parent888a6dfc315d279b15ffb2abd5f35cdea41a8645 (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>
Diffstat (limited to 'src')
-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
{