[webkit-qt] Extending Qt's QML WebView feature set
jkt at flaska.net
Thu Nov 1 11:36:46 PDT 2012
I'm using the WebView QML component in the Harmattan version of my IMAP
e-mail client called Trojita . The WebView component is used for
rendering of actual e-mails, so I need quite an amount of control over
how the webkit underneath operates.
In Qt 4.7 (which ships on Harmattan), I had to basically maintain a fork
of the QDeclarativeWebView class, see  for how it looks like. The
changes I needed were:
1) Make the QWebSettings property available to the QML code, and publish
the userStyleSheet property through that. This was needed to make the
WebView render things in white on black background , a theme which is
used throughout my application.
2) Make it possible to provide a custom QNetworkAccessManager for each
WebView instance. This is very important for various reasons I outlined
in  -- in short, each e-mail being displayed must not access the
network without an explicit user's acknowledgement for privacy reasons.
It can also only ever have access to a single IMAP message at a time. In
order to support a use case where multiple messages are open at once,
one therefore has to use two distinct QNAM instances, one for each
WebView, which makes QDeclarativeNetworkAccessManagerFactory not
suitable for this job (apart from any possible threading issues). My
patch makes it possible to use a QNAM subclass provided by the user's
The patches will have to be cleaned up (they're against a 4.7 release of
Qt, for one thing, and use Trojita-specific naming to prevent any
clashes as well). I am not familiar with Qt5/WebKit release plans and I
also don't like wasting time preparing patches which nobody would
accept, which is why I'd like to ask here -- would you guys accept
patches adding this functionality? And what's the probability of them
being included in Qt 5.0?
With kind regards,
Trojita, a fast e-mail client -- http://trojita.flaska.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 259 bytes
Desc: OpenPGP digital signature
More information about the webkit-qt