Qt 4.6: What's New in Qt 4.6

|  | Home · All Classes · Overviews |

# What's New in Qt 4.6

Qt 4.6 provides many improvements and enhancements over the previous releases in the Qt 4 series. This document covers the most important features in this release, separated by category.

A comprehensive list of changes between Qt 4.5 and Qt 4.6 is included in the `changes-4.6.0` file available online. A list of known issues for this release is also available.

Changes between this release and the previous release are provided in the `changes-4.6.0-tp1` file (also available online).

A list of other Qt 4 features can be found on the What's New in Qt 4 page.

Highlights

- Animation Framework
- State Machine Framework
- Multi-touch & Gestures
- DOM access API
- Qt3D enablers
- Performance Optimizations
- Multimedia Audio Services

## Animation Framework

The animation framework helps build highly animated, high-performance GUIs without the hassle of managing complex structures, timers, and easing curves, not to mention the large state graphs that all animated GUIs tend to be full of.

The framework makes it easy to animate QObjects, including QWidgets, by allowing Qt properties to be animated. It also allows creating custom animations and interpolation functions. Graphics views are not left out--one can animate QGraphicsWidgets, which inherits from QObject (and thereby enables properties).

Animations are controlled using easing curves and can be grouped together. This enables animations of arbitrary complexity.

The API is easy to grasp with functions such as start(), stop(), pause(), and currentTime(). Here is an image from one of the examples that come with the framework:

The animation framework also plugs into the new Qt Statemachine by allowing an animation to be played when transitions are triggered. The state machine framework is introduced in 4.6 and is described below.

## State Machine Framework

The state machine framework provides a robust state chart implementation based on Harel statecharts and SCXML. Qt's API lets you construct such state graphs and execute them. The key benefits of a state machine are:

- Simplify complex application semantics.
- Use of states to reduce code bloat.
- Use states to improve maintainability.
- Makes event-driven programming robust and more reusable.

It is especially the last item here that makes using a state machine worthwhile. A key characteristic of event-driven systems (such as Qt applications) is that behavior often depends not only on the last or current event, but also the events that preceded it. With statecharts, this information is easy to express.

The framework fits neatly into Qt by allowing transitions to trigger on signals and QEvents. By inserting animations into the state machine, it is also easier to use the framework for animating GUIs, for instance.

## Multi-touch & Gestures

The new multi-touch and gestures support enables user interaction with more than one finger, and combines sequential touch inputs to a 'gesture'.

The main benefits of this new functionality are:

- Allow users to interact with applications in better ways.
- Simplify finger-based interaction with UI components.
- Allowing common basic gestures and multi-touch gestures.
- Enable extensibility.

## DOM access API

Web pages and XML both have very complex document object models. The W3C selector API provides a very simple way to access and manipulate such structures. This API makes it intuitive to access DOM, helps reuse CSS selector knowledge, and gives little maintenance or footprint overhead.

     QWebElement document = frame->documentElement();
     QList<QWebElement> allSpans = document.findAll("span");
     QList<QWebElement> introSpans = document.findAll("p.intro span");

## Qt3D enablers

As more of Qt, and more of the applications built on Qt go 3D, API's should be provided to simplify this. Mainly, the new API aims to make it more easy to create 3D applications with OpenGL. It will also unify the Qt OpenGL codebase, and enable cross-platform 3D codebase.

The main features of the Qt3D enablers are currently: Math primitives for matrix multiplication, vectors, quaternions (client-side), and API for vertex and fragment shaders, GLSL/ES. Future research will, among other things include stencils, scissors, vertex buffers and arrays, texture manipulation, and geometry shaders.

## Performance Optimizations

As always, Qt continuously strive to optimize its performance. For this release, we have:

- Rewritten the QGraphicsView rendering algorithm.
- Made QPixmapCache support efficient Key datastructure.
- Reduced overhead in QNetworkAccessManager.
- Added the QContiguousCache class, which provides efficient caching of contiguous data.
- Removed Win9x support.

## Multimedia Audio Services

Qt 4.6 comes with new classes for handling audio. These classes provide low-level access to the system's audio system. By specifying the audio format (QAudioFormat) and supplying audio data through a QIODevice, you get direct access to the functionality of the sound device. The API also comes with functions to query audio devices for which audio formats they support.