Experimenting with Chromium™ and Qt

Chromium is the open source project that powers the Chrome browser. It is not only an HTML renderer, but it also comes with a complete implementation of the web platform - from the network stack up to the multimedia framework.
Just like Qt, it is available on multiple desktop and mobile platforms. So what if Qt developers want to make use of it in the universe of Qt?

Well, for the past few weeks we have actually been busy experimenting with exactly that.
Today we would like to present the prototype of our work, that demonstrates the integration of Chromium into QtQuick2 and Widgets.

Cross platform support was not the main focus for this prototype though. Instead we tried to keep our changes to Chromium to a minimum.
This is why we are using gyp and ninja as a build system for this project - nicely wrapped in a qmake project.

Just try it out for yourself, and send us feedback. To build and run the examples simply follow the instructions below.
However, keep in mind that this is currently only a prototype for the sake of experimenting. There is no stable API and no promise of future support.

Get the sources and build the prototype

To be able to build and run the prototype you must have a recent build of Qt5 (v5.1.0-rc1).
Installing the build dependencies on Ubuntu:

sudo apt-get build-dep chromium-browser

Install the Chromium depot_tools and fetch the Chromium sources (this might take a while):

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=$PWD/depot_tools:$PATH
fetch chromium --nosvn=True
export CHROMIUM_SRC_DIR=$PWD/src

Clone the QtWebEngine repository and apply our Chromium patches:

git clone git://gitorious.org/qt-labs/qtwebengine.git
./qtwebengine/patches/patch-chromium.sh

Build QtWebEngine:

cd qtwebengine && qmake && make

Running the examples

The QtWebEngine repository contains two example applications. One of them uses QtQuick2 and the other one uses Widgets. The examples are very simplistic web browsers using a Chromium based webview.
Both implementations can be found in the examples subdirectory and can be executed from the command line.

Known limitations:

  • Currently the only platform supported by the prototype is Linux/X11.
  • There is no integration with QNetworkAccessManager.

Chromium is a trademark of Google Inc.


Blog Topics:

Comments