summaryrefslogtreecommitdiffstats
path: root/src/webengine
diff options
context:
space:
mode:
authorSzabolcs David <davidsz@inf.u-szeged.hu>2015-12-04 04:11:48 -0800
committerSzabolcs David <davidsz@inf.u-szeged.hu>2015-12-07 15:07:02 +0000
commitc6c58e0e03e2ba9b9dd8e149cab30b8eb12c443f (patch)
tree9dad09074cf5775434d2ffaa79f7b8953c1b2f4b /src/webengine
parent99bb80faed580fd3d61171541bc3b1c7601366ff (diff)
Quick: Close WebUI popups properly
This patch deactivates the web view with a FocusOut event when it turns to invisible and Chromium closes its WebUI popups. In case when the window is closing, we can't always rely on the destroyed() signal or the visibility state of the WebEngineView, since we have multiple top level windows and the destroying order of the items is not so trivial as in the single-window case. Task-number: QTBUG-49099 Change-Id: I802a47c72eed3ed6352f1ba24998622fc95bb48a Reviewed-by: Alexandru Croitor <alexandru.croitor@theqtcompany.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'src/webengine')
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.cpp11
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
index 9fc1ed3eb..508420cf8 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
+++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
@@ -268,10 +268,15 @@ void RenderWidgetHostViewQtDelegateQuick::itemChange(ItemChange change, const It
if (value.window) {
m_windowConnections.append(connect(value.window, SIGNAL(xChanged(int)), SLOT(onWindowPosChanged())));
m_windowConnections.append(connect(value.window, SIGNAL(yChanged(int)), SLOT(onWindowPosChanged())));
+ if (!m_isPopup)
+ m_windowConnections.append(connect(value.window, SIGNAL(closing(QQuickCloseEvent *)), SLOT(onHide())));
}
if (m_initialized)
m_client->windowChanged();
+ } else if (change == QQuickItem::ItemVisibleHasChanged) {
+ if (!m_isPopup && !value.boolValue)
+ onHide();
}
}
@@ -285,4 +290,10 @@ void RenderWidgetHostViewQtDelegateQuick::onWindowPosChanged()
m_client->windowBoundsChanged();
}
+void RenderWidgetHostViewQtDelegateQuick::onHide()
+{
+ QFocusEvent event(QEvent::FocusOut, Qt::OtherFocusReason);
+ m_client->forwardEvent(&event);
+}
+
} // namespace QtWebEngineCore
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.h b/src/webengine/render_widget_host_view_qt_delegate_quick.h
index eb2860b27..7c44da9b9 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quick.h
+++ b/src/webengine/render_widget_host_view_qt_delegate_quick.h
@@ -92,6 +92,7 @@ protected:
private slots:
void onWindowPosChanged();
+ void onHide();
private:
RenderWidgetHostViewQtDelegateClient *m_client;