diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2016-09-07 13:26:53 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2016-10-14 09:11:39 +0000 |
commit | ee6f018a67b6443100a1454c9ab9a7a897289535 (patch) | |
tree | 1cd2f0b8a0de9017229d8890609442123bcf6385 | |
parent | 2b953bf803aa74f4c6e1e3f06b22887c1ac80961 (diff) |
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 <allan.jensen@qt.io>
-rw-r--r-- | src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp | 7 | ||||
-rw-r--r-- | src/webenginewidgets/webenginewidgets.pro | 2 |
2 files changed, 8 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 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 <QWindow> #include <private/qsgcontext_p.h> #include <private/qsgengine_p.h> +#include <private/qwidget_p.h> 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 |