diff options
author | Michael Bruning <michael.bruning@theqtcompany.com> | 2015-11-24 17:09:50 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@theqtcompany.com> | 2015-11-25 20:13:59 +0000 |
commit | 754edb8dadb9b3086f67eadabdde9659dfcb7caf (patch) | |
tree | 78de1ae8dbb56ee259feb91bb67ef07d0d7170ba | |
parent | c1ae43bbf402ffd4c39218471508ed8477e66254 (diff) | |
download | qtwebengine-754edb8dadb9b3086f67eadabdde9659dfcb7caf.tar.gz |
Reassociate the web channel when setting a profile.
The WebContentsAdapter gets recreated and the QmlWebChannel needs to be
reassociated with the new adapter instance.
Change-Id: I88494fd379c429f2ae98df95a22c04c334452088
Task-number: QTBUG-49521
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
-rw-r--r-- | src/webengine/api/qquickwebengineview.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index c35b7aeb8..c323f486b 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -763,8 +763,12 @@ void QQuickWebEngineViewPrivate::setProfile(QQuickWebEngineProfile *profile) if (adapter && adapter->browserContext() != browserContextAdapter()->browserContext()) { // When the profile changes we need to create a new WebContentAdapter and reload the active URL. QUrl activeUrl = adapter->activeUrl(); + QQmlWebChannel *qmlWebChannel = qobject_cast<QQmlWebChannel *>(adapter->webChannel()); adapter = 0; ensureContentsAdapter(); + if (qmlWebChannel) + adapter->setWebChannel(qmlWebChannel); + if (!explicitUrl.isValid() && activeUrl.isValid()) adapter->load(activeUrl); } |