[Development] QWebChannel communication with QWebEngineView
Scott Bloom
scott at towel42.com
Fri Sep 26 18:34:30 CEST 2025
From: Development <development-bounces at qt-project.org> On Behalf Of Scott Bloom
Sent: Friday, September 26, 2025 09:29
To: Arno Rehn <a.rehn at menlosystems.com>; development at qt-project.org
Subject: Re: [Development] QWebChannel communication with QWebEngineView
From: Arno Rehn <a.rehn at menlosystems.com<mailto:a.rehn at menlosystems.com>>
Sent: Friday, September 26, 2025 02:02
To: development at qt-project.org<mailto:development at qt-project.org>
Cc: Scott Bloom <scott at towel42.com<mailto:scott at towel42.com>>
Subject: Re: [Development] QWebChannel communication with QWebEngineView
Hey Scott,
On 26.09.2025 01:31, Scott Bloom wrote:
I have found the webchannel examples. However, my need isn’t covered and I cant for the life extend any of the examples.
The goal is to have a dialog window with a QWebEngineView widget instantiated, the application is all C++.
The main page loaded will be in qrc, but loads other scripts that are also in the qrc.
Is there any example out there that shows a simple WebChannel based communication between Widgets a WebEngineView?
Yes, the RecipeBrowser example does just this: https://doc.qt.io/qt-6/qtwebengine-webenginewidgets-recipebrowser-example.html
Note that QtWebChannel is agnostic to the concrete transport that's used. That's why none of the examples
in the QtWebChannel repo interact with a webview and the actual webview-using examples are in QtWebEngine.
QtWebEngine provides a specialized transport based on Chromium IPC. It's used automatically when you call QWebEnginePage::setChannel() [https://doc.qt.io/qt-6/qwebenginepage.html#setWebChannel].
Cheers,
Arno
Ill take a look. I really appreciate the pointer!
Scott
On a side note, I had asked for this back in the Qt3 days.
It would be great if at the top of the examples directory, there was a document that listed every example and every Qt class used in the example.
Years back I had wrote a perl script to generate it (and I remember emailing it in to Trolltech support as I was a commercial user back then).
As the examples grow and grow, and technology may be used in one example, that is not really what is being highlighted in the example (As is the case here) it would be create to have a top level location to search.
I googled all sorts of “QWebChannel” and “QWebEngineView” example combinations and it never pointed to this example.
Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20250926/e2f01bf1/attachment-0001.htm>
More information about the Development
mailing list