From a6c6665d79e6d4097c0a1155ff5f963b9a9eab19 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 31 Jan 2017 15:01:43 +0100 Subject: Fix QWebEngineView::setFocus to properly set internal QQuickItem focus The widgets object hierarchy related to focus goes like this: QWebEngineView's focus proxy is -> RenderWidgetHostViewQtDelegateWidget, which has an internal QQuickRootItem defined by QQuickWidget, and the child of the item is -> RenderWidgetHostViewQuickItem. Previously when QWebEngineView::setFocus was called, the focus was set on the RenderWidgetHostViewQtDelegateWidget and the QQuickRootItem, but not on the RenderWidgetHostViewQuickItem. This caused for e.g. an active HTML text input not receiving focus. Make sure the RenderWidgetHostViewQuickItem is marked to have focus within its root item, so that if the root item receives active focus, so will RenderWidgetHostViewQuickItem receive it. Task-number: QTBUG-58515 Change-Id: I175610e3dfebc03733aefe26c16f47096df8ff5b Reviewed-by: Allan Sandfeld Jensen --- src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp') 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 69ecbe160..e4c8996e1 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp @@ -64,6 +64,8 @@ public: RenderWidgetHostViewQuickItem(RenderWidgetHostViewQtDelegateClient *client) : m_client(client) { setFlag(ItemHasContents, true); + // Mark that this item should receive focus when the parent QQuickWidget receives focus. + setFocus(true); } protected: void focusInEvent(QFocusEvent *event) override -- cgit v1.2.3