summaryrefslogtreecommitdiffstats
path: root/src/webengine/api/qquickwebengineview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/webengine/api/qquickwebengineview.cpp')
-rw-r--r--src/webengine/api/qquickwebengineview.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index 6c3452a6a..129cfd2de 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -558,11 +558,21 @@ void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContent
}
Q_Q(QQuickWebEngineView);
+
+ // memorize what webChannel we had for the previous adapter
+ QQmlWebChannel *qmlWebChannel = NULL;
+ if (adapter)
+ qmlWebChannel = qobject_cast<QQmlWebChannel *>(adapter->webChannel());
+
// This throws away the WebContentsAdapter that has been used until now.
// All its states, particularly the loading URL, are replaced by the adopted WebContentsAdapter.
adapter = webContents;
adapter->initialize(this);
+ // associate the webChannel with the new adapter
+ if (qmlWebChannel)
+ adapter->setWebChannel(qmlWebChannel);
+
// Emit signals for values that might be different from the previous WebContentsAdapter.
emit q->titleChanged();
emit q->urlChanged();