From ee6f018a67b6443100a1454c9ab9a7a897289535 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 7 Sep 2016 13:26:53 +0200 Subject: Fix IME window placement relative to QWebEngineView The position of the IME window is computed using the widget input item transform. When a regular QWidget gets a focusIn event, the input item transform is recomputed inside the QWidgetPrivate::updateWidgetTransform method. This did not happen for the QWebEngineView, because the focus event is handled internally and not passed down to QWidget::event. Fix consists in calling updateWidgetTransform manually whenever the view receives focus. The other cases when updateWidgetTransform should be called (namely resize and move events) are handled properly by delegating to QWidget::event. Task-number: QTBUG-55634 Change-Id: Ic93662929e169d860f8ca567f1955da4dc45f9fe Reviewed-by: Allan Sandfeld Jensen --- .../render_widget_host_view_qt_delegate_widget.cpp | 7 +++++++ src/webenginewidgets/webenginewidgets.pro | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) 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 a8300aa05..5bc1671df 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp @@ -48,6 +48,7 @@ #include #include #include +#include namespace QtWebEngineCore { @@ -337,6 +338,12 @@ bool RenderWidgetHostViewQtDelegateWidget::event(QEvent *event) } } + QEvent::Type type = event->type(); + if (type == QEvent::FocusIn) { + QWidgetPrivate *d = QWidgetPrivate::get(this); + d->updateWidgetTransform(event); + } + if (event->type() == QEvent::MouseButtonDblClick) { // QWidget keeps the Qt4 behavior where the DblClick event would replace the Press event. // QtQuick is different by sending both the Press and DblClick events for the second press diff --git a/src/webenginewidgets/webenginewidgets.pro b/src/webenginewidgets/webenginewidgets.pro index 5687bffaf..cc48f1198 100644 --- a/src/webenginewidgets/webenginewidgets.pro +++ b/src/webenginewidgets/webenginewidgets.pro @@ -4,7 +4,7 @@ TARGET = QtWebEngineWidgets DEFINES += QT_BUILD_WEBENGINEWIDGETS_LIB QT += webenginecore widgets network quick -QT_PRIVATE += quick-private gui-private core-private +QT_PRIVATE += quick-private gui-private core-private widgets-private INCLUDEPATH += $$PWD api ../core ../core/api ../webengine/api -- cgit v1.2.3