diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-11-05 14:32:25 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2015-11-05 14:32:25 +0000 |
commit | 09018b99dce7a8ed43b0842055e8775d5021cf04 (patch) | |
tree | 8ab6f1b450eb63f981f9275c0f973695d5a3f7b7 /src/webengine/api/qquickwebengineview.cpp | |
parent | a5e14c7abf8fddfbcbc3223e093f8acb50c459d5 (diff) | |
parent | 14430b465d39a602d917f2a701218ed56360dc4e (diff) | |
download | qtwebengine-09018b99dce7a8ed43b0842055e8775d5021cf04.tar.gz |
Merge "Merge branch '5.5' into 5.6" into refs/staging/5.6
Diffstat (limited to 'src/webengine/api/qquickwebengineview.cpp')
-rw-r--r-- | src/webengine/api/qquickwebengineview.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 52245e147..29f819eb3 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -653,11 +653,25 @@ 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); + + // re-bind the userscrips to the new adapter + Q_FOREACH (QQuickWebEngineScript *script, m_userScripts) + script->d_func()->bind(browserContextAdapter()->userScriptController(), adapter.data()); + // Emit signals for values that might be different from the previous WebContentsAdapter. emit q->titleChanged(); emit q->urlChanged(); |