From 04f58ffc1904bef7ba788b56ed098a7823017e65 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Thu, 31 Jul 2014 17:24:26 +0200 Subject: Fix tab focus in the widgets and QML webviews Fixes: - Make sure that we call SetInitialFocus when giving focus through Tab This does the same as would WebContents::FocusThroughTabTraversal - Implement QWebEnginePagePrivate::passOnFocus - Set each new RWHVQtDelegate as the focus proxy of the QWebEngineView - Make sure that the widgets delegate accepts the tab focus policy Cleaups: - RenderWidgetHostViewQtDelegateQuick doesn't need to be a focus scope, it doesn't have any children - We don't need to reimplement QQuickWebEngineView::forceActiveFocus since the view is now a focus scope - Do not explicitly setFocus(true) on the QQuickWebEngineView, the application should decide this through the API Change-Id: I817dc2c895d4fff4aa3536c71ecc5d306bb3bee0 Reviewed-by: Andras Becsi --- src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (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 98c6265aa..f4c2b2a13 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp @@ -60,7 +60,7 @@ RenderWidgetHostViewQtDelegateWidget::RenderWidgetHostViewQtDelegateWidget(Rende , sgRenderContext(new QSGRenderContext(sgContext.data())) , m_isPopup(false) { - setFocusPolicy(Qt::ClickFocus); + setFocusPolicy(Qt::StrongFocus); setMouseTracking(true); setAttribute(Qt::WA_AcceptTouchEvents); setAttribute(Qt::WA_OpaquePaintEvent); @@ -72,6 +72,7 @@ void RenderWidgetHostViewQtDelegateWidget::initAsChild(WebContentsAdapterClient* QWebEnginePagePrivate *pagePrivate = static_cast(container); if (pagePrivate->view) { pagePrivate->view->layout()->addWidget(this); + pagePrivate->view->setFocusProxy(this); QOpenGLWidget::show(); } else setParent(0); -- cgit v1.2.3