New Qt 5 / WebKit 2 WebView APIs

By ICS | Monday, February 6, 2012

There was no blog posting last week because I was away for some vacation in a warm place.

This week work continued implementing the APIs for Accelerometer and Notification and using the Qt Simulator for testing.


We also started looking at the new APIs needed to use WebKit2 from Qt 5. With Qt 5 and Webkit2 the APIs for QtWebKit and Web View are changing significantly. This is because with WebKit2, WebKit and the application run in different processes. The old QWebView widget will only be supported on Qt for desktops and won't use the new WebKit2. Mobile phone platforms typically won't have the QWidgets module installed in Qt 5. We want to use WebKit2 to leverage scene graph and other improvements in WebKit2.


If you build QtWebKit from git, the experimental support for communicating with the QML WebView element via messages is present. From QML you need to do:

    import QtQuick 2.0
    import QtWebKit 3.0
    import QtWebKit.experimental 3.0

I have been reading the earlier mailing list postings that describe the new messaging support and working on some QML and HTML proof of concept code that exercises the new messaging support. It runs under "qmlscene" and demonstrates how to send messages between QML and the Web View browser's JavaScript environment. This will let us explore if the new APIs will allow us to do what is needed to hook a QML Web View element up to the PhoneGap APIs we are implementing.

These references explain more:

  1. http://labs.qt.nokia.com/2011/08/31/an-oldnew-approach-to-qtwebkit-hybrid/
  2. https://lists.webkit.org/pipermail/webkit-qt/2011-October/001953.html
  3. https://lists.webkit.org/pipermail/webkit-qt/2012-January/002394.html
  4. https://lists.webkit.org/pipermail/webkit-qt/2011-October/001943.html


Have a question or add to the conversation: Log in Register