For desktops (Windows, Mac, Ubuntu), there is a QWebEngineView
and for mobiles (Android, iOS), there is a native QWebView
.
Unfortunately, mobiles don't support QWebEngineView
.
For example, as discussed in below post:
How to use Qt WebEngine and QWebChannel?
The setWebChannel()
is available in QWebEnginePage
which is accessible only in QWebEngineView
. However, QWebPage
doesn't have such method which is accessible in QWebView
.
Now, there is another platform independent way, which works on all the platforms, as discussed in Integrating Web Content.
But the example uses QWebChannelAbstractTransport
, which can be used only with JSON
. Now JSON, due to its over-descriptive nature, could be quite expensive, if the C++ module is sitting somewhere in server and HTML is local; i.e. real client-server communication over internet.
It would have been better, had they use protobuf.
Is there any optimised and platform agnostic way of calling HTML/Javascript from C++ in Qt?
[Note: BTW, current Qt way of calling C++ from Javascript is quite handy using channel.objects
and I would like to retain that way.]