Mobile

Qt 5 Beta: A Developer's Tour

By Eero Penttinen, September 07, 2012

The just-released Qt5 beta shows the library and toolkit thriving and continuing to add capabilities, while simplifying development even more.

Qt 4.0 was released in June 2005, a full seven years ago. During that time, Qt has evolved a lot, making it better suited for mobile development. However, it was obvious that major changes were needed to better address the different needs of the Qt community and to finally make Qt a first-class citizen on mobile devices. The vision of Qt 5 was communicated in a blog post by Qt Chief Maintainer Lars Knoll in May 2011  make better use of the GPU, allowing the creation of smoother and more fluid applications, even with limited resources, using Qt Quick and JavaScript as the primary building blocks. Even though Qt Quick provided a good development experience as of Qt 4.7, some fundamental changes were needed to ensure smooth, large-scale Qt Quick-based applications on embedded devices with limited resources. Additional important aspects of the vision were to provide better integration with Web content into any Qt application, but at the same time, acknowledge that some complexities and the amount of code needed to be reduced.

Development of Qt 5

Earlier versions of Qt were mostly developed in-house at Nokia (and previously, Trolltech). But since the launch of qt-project.org, a vibrant community has been participating in development of Qt 5 and many features and patches in Qt 5 (including supported platforms) have been done by the community.

The Qt Project governs the open source development of Qt. It allows anybody wanting to contribute to join the effort through a meritocratic structure of approvers and maintainers. All development is driven by the people contributing to the project.

Architectural Changes

In Qt 5, following major changes were accomplished:

All ports of Qt are based on the Qt Platform abstraction layer (QPA). QPA is the platform abstraction layer for Qt 5 and replaces QWS and the platform ports from Qt 4. Benefits of using QPA are that the architecture is much cleaner where platform dependent code is abstracted and the new abstraction makes it much easier to integrate Qt with new windowing systems.

New graphics architecture. Qt 5 introduces a new graphics architecture for Qt Quick using Scenegraph on top of OpenGL. OpenGL (ES) 2.0 is mandated for this to work. The new architecture makes it easier to integrate OpenGL-based content, such as shader effects, with Qt Quick-based applications. The QWidget-based stack continues to work as in Qt 4.x (based on QPainter), but supported back-ends have been limited to SW rasterization, pixmaps, and images, an OpenGL backend for GL surface,s and a backend for PDF generation and printing. X11 and CoreGraphics are no longer supported.

Modular repository structure. This enables more independent development of Qt modules, but also makes it easier to integrate contributions in the form of third-party modules to Qt. Modularization is also important because it also responds the need to have different requirements supported on desktops and tablets/mobiles.

All QWidget-related functionality is separated into its own library. A continued use of QWidgets is secured, but at the same time,it helps to have a clean architecture in Qt 5 to continue evolution of Qt Quick. Qt Widgets are also ported on top of QPA.

The Structure of Qt 5

Figure 1.

Modules have been split into Qt Essential Modules and Qt Add-on Modules. Essential modules are mandatory in all platforms. Add-on modules can be included optionally in Qt enabled platforms. Add-on modules can roughly be divided into following categories:

Modules that are provided for Qt 4.x compatibility

Modules that have been part of previous Qt mobility releases

Modules that are useful on a limited number of platforms like Qt D-Bus

Modules that are potential candidates to be part of Qt Essential modules in some future Qt release.

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task.
However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Video

This month's Dr. Dobb's Journal

This month,
Dr. Dobb's Journal is devoted to mobile programming. We introduce you to Apple's new Swift programming language, discuss the perils of being the third-most-popular mobile platform, revisit SQLite on Android
, and much more!