Integrating Web Content

The QtWebKit module provides a WebKit-based layout engine with support for a wide range of standard web techologies such as HTML, CSS and JavaScript, that make it possible to embed content from the World Wide Web into your Qt application.

QtWebKit provides the QtWebKit Widgets C++ classes to integrate web content into your QWidget and QGraphicsView based application. QtWebKit also includes a WebView QML component for embedding into Qt Quick.

QtWebKit Widgets integration

The QtWebKit Widgets module provides a number of different classes with a feature-rich C++ API that facilitates loading, viewing and editing web documents (QGraphicsWebView, QWebView, QWebPage, QWebFrame) or traversing the document model represented by a tree structure of DOM elements (QWebElement). The QtWebKit Widgets classes provide traditional in-process rendering of web content.

QtWebKit Qt Quick integration

The QtWebKit module can be integrated into Qt Quick by importing the WebView QML component. The WebView item has a minimalistic QML API for web content visualization which is not as feature-rich as the C++ API of the widget classes but it has out-of-the-box multi-touch support and employs a multi-process architecture to render web content in a separate helper process (QtWebProcess). The WebView makes it possible to interact with content using touch gestures such as panning with inertia (flick), pinch-zoom, tap and double-tap-to-zoom. The underlying split-process model (WebKit2) assures smooth animations in the embedding application (UI process) as well as increases stability.

Examples demonstrating how to embed web content into a Qt application can be found in the qtwebkit-examples-and-demos module. Specifically the QML examples flickrview and youtubeview in this module show how to integrate web content into a Qt Quick application.