[Development] Though about rich text (html, WebView) rendering

Koehne Kai Kai.Koehne at theqtcompany.com
Fri Feb 26 11:15:48 CET 2016



> -----Original Message-----
> From: Development [mailto:development-
> bounces+kai.koehne=theqtcompany.com at qt-project.org] On Behalf Of
> Fabrice Salvaire
> Sent: Thursday, February 25, 2016 1:33 PM
> To: development at qt-project.org
> Subject: [Development] Though about rich text (html, WebView) rendering
> 
> Dear all,
> 
> I am investigating to port a content server to an off-line mobile application
> in order to don't rely to a network connection at all. Thus I have to port a
> database, a kind of web framework, a template engine and a rendering
> engine. I believe it can be a use of case of Qt on mobile platform.
> 
> If we consider HTML is the right way to display rich text there is actually to
> solution with Qt : Text for basic HTML and WebView for a full compliance. I
> am not sure to understand why we cannot use WebEngine on mobile
> platform. WebEngine seems more interesting since it provides WebChannel
> hooks.

Let's be clear here on the terminology: With "WebView" I assume you refer
to Qt WebView (http://doc.qt.io/qt-5/qtwebview-index.html), which on Android
integrates the native browser. Since Qt WebChannel can use WebSockets as
a means of communciation, you can use it with Qt WebView on Android, too.
You'd need to set up a local websocket server though ("ws://localhost/...").
Not sure how exactly that works for an Android app.

Qt WebEngine is indeed currently only supported for Windows, OS X and
Linux. Porting it to Android is possible, but a lot of work.

> I succeed to hack the WebView using the loadingChanged signal in order to
> simulate a dynamic HTML framework, i.e. call loadHtml according to the url.
> But I don't known if it is the right way to achieve this. Maybe we can extend
> the Java wrapper for this purpose? The fact the rendering surface is a light
> web browser behind the scene can be disturbing since it doesn't integrate
> very well with the QML application.

I'm not sure I really understood what you've been doing with the loadingChanged
Signal. 

A tight integration into the scene graph is indeed an advantage of Qt WebEngine.

> I think there is something evil since a Web engine is a concurrent of QML.

What do you mean by that?
 
> We can render math formulas out of the box using a QML WebView and
> mathjax, but we can also implement a full application using HTML5 and
> javascript. Thus use a stack over a stack ...
> 
> What is the future plan and advices for this topic?

I'm afraid there are no direct plans to support Qt WebEngine on Android.
If I'd be you I'd try to set up a WebSocket. If that ain't possible you could
Still try to communicate between the WebView and your app 
just via runJavaScript().

Regards

Kai



More information about the Development mailing list