The Qt development toolkit is undergoing a major overhaul. The developers behind the project announced the availability of the Qt 5 alpha release this week. It's a key milestone on the path to the official launch of Qt 5, expected to occur later this year.

Qt is an open source toolkit designed to support cross-platform desktop and mobile application development. It provides libraries, user interface controls, and other components. Qt was originally created by Trolltech, a Norwegian software company that Nokia acquired in 2008. Nokia subsequently relicensed Qt under more permissive terms and transitioned the toolkit to a community-driven open governance model.

The rise of Qt Quick

The update to Qt 5 will bring many significant technical and philosophical changes to the toolkit. The developers aim to transition the focus of Qt away from the traditional widget system (based on QWidget C++ classes) in favor of Qt Quick, a declarative scripting framework for building rich interfaces. This change will gradually shift Qt application developers away from the toolkit's C++ roots.

Qt Quick allows developers to construct distinctive interfaces with arbitrary graphical assets, fluid animations, advanced touchscreen support, and greater interactivity. Qt Quick was first introduced in Qt 4.7 as a foundation for building better mobile experiences. At the time, Nokia hoped that Qt Quick would give developers the ability to make more competitive applications for its aging Symbian platform and nascent Linux-based mobile operating system.

As the value and technical potential of Qt Quick became apparent, it gradually took a more central role in the Qt landscape. Its status as the preferred method for building Qt user interfaces will finally be official with the launch of Qt 5.

Qt Quick provides a unique declarative syntax called QML for describing the structure of a user interface layout. The syntax, which sort of resembles an abbreviated form of JSON, consists largely of nested structures with property and value pairs. JavaScript expressions can be used seamlessly in place of any value in a QML layout.

In Qt 4.7 and 4.8, developers use Qt Quick by embedding a declarative view control in a regular QWidget based user interface. The view is then configured to load and render a QML layout. The developer implements their underlying application logic and data model in C++ with Qt's MVC framework.

Then the data model is bound to the QML layout, which displays it with a rich interactive interface. Much like QtScript, the Qt Quick framework makes it easy to expose C++ objects, properties, and methods into the QML environment and its JavaScript runtime. The heavy lifting is all done with C++, while JavaScript is used only as a glue language to handle user interface events.

The vision for Qt 5 is to move to an approach where Qt developers build their applications with QML and JavaScript, doing much of the application logic with scripting. C++ would then typically only be used to implement plugin libraries that extend the capabilities of the Qt Quick runtime. That's the direction that the toolkit is moving, but it's not going to get there entirely this year.

The initial 5.0 release will be somewhat transitional, delivering the necessary architectural changes but not all of the requisite functionality. According to the release announcement, it will likely take one or two point releases to advance the toolkit to the point where it can fully accommodate the new development model.

Qt Quick 2.0

Qt Quick is getting some profound changes under the hood to ready it for its new responsibilities. The Qt Quick canvas has been rebuilt on top of an OpenGL scene graph framework with hardware-accelerated rendering. Some of you might remember some of the early Qt scene graph rendering experiments from 2010, which paved the way for this change in Qt 5.

The result will be significantly better performance and lower CPU overhead for QML. Animations and other graphically-intensive aspects of QML rendering will be smoother, more efficient. The implementation supports OpenGL and OpenGL ES 2.0. It will work on desktop computers and mobile devices with suitable graphics hardware.

Another area where Qt Quick is going to see major changes in Qt 5 is its underlying JavaScript engine. In Qt 4.7 and 4.8, the Qt Quick scripting runtime is powered by WebKit's JavaScriptCore engine. It is going to be replaced with Google's V8 engine in Qt 5. Adopting V8 is said to greatly increase JavaScript execution performance in typical QML usage scenarios.

The advantages of switching to the scene graph and V8 will help make Qt Quick perform well enough to handle a lot of the heavy lifting in applications. Qt application developers won't have to rely on C++ in order to get reasonable performance for many kinds of programs.

In addition to these architectural changes, the Qt developers have also done some work to overhaul the Qt Quick C++ APIs and change their naming scheme. The standard QDeclarative prefix has been dropped in favor of the less verbose QQuick prefix.

A number of additional capabilities have also been added to Qt Quick, including some that are supplied through optional plugins. Qt 3D, for example, provides a high-level QML-based framework for rendering 3D graphics. It supports scene management, lighting, model loading, texture handling, and camera positioning. It supports QML's declarative model for animating and manipulating 3D shapes.

Another new optional plugin supplies mapping and location widgets that can be integrated into a QML layout. A new canvas module provides a generic painting surface in Qt Quick with JavaScript APIs that are modeled after the ones associated with the HTML5 Canvas element. There is also a module for drawing 2D particle graphics.