File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -558,11 +558,21 @@ void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContent
558
558
}
559
559
560
560
Q_Q (QQuickWebEngineView);
561
+
562
+ // memorize what webChannel we had for the previous adapter
563
+ QQmlWebChannel *qmlWebChannel = NULL ;
564
+ if (adapter)
565
+ qmlWebChannel = qobject_cast<QQmlWebChannel *>(adapter->webChannel ());
566
+
561
567
// This throws away the WebContentsAdapter that has been used until now.
562
568
// All its states, particularly the loading URL, are replaced by the adopted WebContentsAdapter.
563
569
adapter = webContents;
564
570
adapter->initialize (this );
565
571
572
+ // associate the webChannel with the new adapter
573
+ if (qmlWebChannel)
574
+ adapter->setWebChannel (qmlWebChannel);
575
+
566
576
// Emit signals for values that might be different from the previous WebContentsAdapter.
567
577
emit q->titleChanged ();
568
578
emit q->urlChanged ();
You can’t perform that action at this time.
0 commit comments