LWN.net Logo

A look at Qt 4.6

December 9, 2009

This article was contributed by Nathan Willis

Nokia updated its Qt application framework to version 4.6 on December 1st, adding support for several operating systems — most notably its own mobile platforms: the recently open source Symbian and the Linux-based Maemo. Qt 4.6 introduces new graphics features, new input methods, and updates to the QtScript scripting engine. Along with the framework itself, Nokia updated its cross-platform Qt integrated development environment (IDE) Qt Creator to support the new features and new target platforms.

Qt everywhere

Previous releases of Qt have supported Linux, similar X11-based Unix clones, Mac OS X, and Windows desktop operating systems, plus embedded Linux systems and the Windows smartphone platforms (Windows CE and Windows Mobile). Qt 4.6 updates the proprietary platform support to the latest offerings from Apple and Microsoft: Mac OS X 10.6 and Windows 7.

More interesting to open source users is the official addition of three mobile platforms to the line-up: Symbian S60, Maemo 5 "Fremantle," and the still-in-development Maemo 6 "Harmattan." S60 was Nokia's platform of choice for high-end smartphones for years, but its recent moves indicate it is positioning Symbian as a lower-end phone operating system and cultivating Maemo for high-end devices. "Preview" Qt releases for both S60 and Maemo 5 have been periodically released over the past year, but the platforms' official support in 4.6 is new.

Given that the first Maemo 5 device (Nokia's N900) only started shipping in November, support for Maemo 6 may sound premature. The early release is in line with Nokia's past Maemo development behavior, however. The core Nokia-developed applications in Maemo 6 will be rewritten in Qt instead of GTK+ and Hildon, and Qt will be designated the officially supported toolkit for application development. Nokia has long tried to get development tools into the hands of the open source community as early as possible to accelerate Maemo application development, and the Maemo 6 shift in toolkits is undoubtedly a disruption the company wants to minimize.

Inside the release

The headlining new features in 4.6 are the Qt Animation Framework and State Machine Framework. The two APIs work together; more generally the state machine framework allows application developers to construct their code around state graphs, in which the system reacts to stimuli such as user input by changing between pre-defined states — hopefully leading to better dynamic user interfaces. As the documentation points out, writing a state-based application is not required, and simple applications may not see the benefit. But using the state machine does open up some other useful APIs, including animation.

The animation framework allows developers to animate transitions between states, rather than defining animations as timeline-based behavior triggered by events. The animation framework automatically interpolates between the "start" and "stop" states of the animated object, and handles pausing, synchronizing multiple animations, and other details.

Two new input methods debut in 4.6, gesture input and multi-touch. Multi-touch builds on the existing touch-sensitive interface of the QTouchEvent class. Qt now handles multiple QTouchEvents simultaneously, and can send different events to different widgets, or to the same widget. The framework maintains backward-compatibility with older code by translating QTouchEvents into QMouseEvents for multi-touch unaware applications. Gestures are built on top of multi-touch, as gestures may involve multiple touch points. The QGestureEvent class provides gesture descriptions and handling.

The QGraphicsEffect class allows Qt to perform basic visual effects on arbitrary elements, including blurring, drop-shadowing, colorization, and changing opacity. There are also new classes in 4.6 to handle audio, and a Qt3D API to simplify writing 3-D applications.

Nokia highlights several changes as "performance optimizations." Some, like a new renderer for the QGraphicsView class, are enhancements to existing features. Others, such as the QContiguousCache class (which enables more efficient memory caching by keeping larger chunks of cached data in contiguous locations) and hardware-acceleration for 2-D vector graphics via the OpenVG API, qualify as new features in their own right.

Several key pieces of code for web integration made their way into 4.6. QtScript, the framework's JavaScript/ECMAScript scripting engine, has a new backend in 4.6 based on WebKit's JavaScriptCore, which is reportedly considerably faster. The QWebElement class provides an API to access and manipulate the document object model (DOM) of both web pages and XML documents.

Qt Creator and ... world domination?

[Qt Creator]

The Qt Creator IDE was bumped to version 1.3 when Qt 4.6 was released and supports the new features of the toolkit. The official changelog details a long list of improvements, most of which fall under the category of regular enhancements to a still-growing IDE: improved syntax highlighting and semantic parsing, better searching, better code refactoring, and so on.

It is telling, however, that here again Nokia's press releases lead off with the fact that Qt Creator now supports Symbian as a target platform. Nokia's corporate interest is in building Qt into a cross-platform toolkit and SDK that can run on every platform available. Linux users may occasionally lose sight of that fact because of the framework's prominence in desktop projects like KDE (which will be migrating to 4.6 in version 4.4.0). But in the broader technology market, the sheer number of Symbian-powered phones (half of all smartphones, on the order of hundreds of millions) dwarfs the desktop Linux market easily.

Symbian is now open source, of course, following its 2008 acquisition by Nokia. Maemo may be the company's ace in the hole for future smartphone products, but Qt is the tool it will use to keep the programmers developing for those millions of smartphones from migrating to other platforms as Maemo matures.

Fortunately for open source users, Nokia seems to be working well with the community. In addition to its code contributions, Nokia has also opened up the Qt development process itself, accepting around 160 code contributions from outside the company, and making the source code repository and official bug tracker publicly accessible. Qt 4.6 adds some exciting new features, including multi-touch gestures and an easy-to-use animation API. But the open development process that brought it to market is just as welcome.


(Log in to post comments)

A look at Qt 4.6

Posted Dec 9, 2009 20:21 UTC (Wed) by wesmo (guest, #50706) [Link]

Qt will also become the standard app development environment in Symbian^4.

A look at Qt 4.6

Posted Dec 10, 2009 11:25 UTC (Thu) by bo (subscriber, #56215) [Link]

From the perspective of someone who uses Qt for work, one of the cooler (read: timesaving) features introduced by 4.6 is the XML Schema validation.
No more writing code to handle missing tags or porly formed data, simply run it through QXMLSchemaValidator's validate() :)

A look at Qt 4.6

Posted Dec 11, 2009 13:52 UTC (Fri) by cventers (guest, #31465) [Link]

That's cool. I use Qt professionally as well, and I'm continually stunned by how much better the toolkit gets with every release. I like it so well that it distracts me from how much I prefer C over C++.

A look at Qt 4.6

Posted Dec 10, 2009 14:15 UTC (Thu) by ikm (subscriber, #493) [Link]

I'm loving Qt Creator. It's the first IDE for Linux which doesn't suck, for me of course. Anyone doing C++ w/ Qt development, or even just plain C++, should definitely check it out.

In a broader view, looks like Qt acquisition worked very well for both Qt, Nokia and the rest of us.

A look at Qt 4.6

Posted Dec 10, 2009 17:21 UTC (Thu) by batsys (subscriber, #54289) [Link]

The new QtCreator 1.3 is a definite improvement over the older version. There are still some problems though; off the top of my head:

- it's a bit on the slow side
- missing basic features such as insert/overwrite mode
- autocompletion of header files doesn't cope with relative paths

There are a lot more issues but to be fair these are annoyances rather than show-stoppers. I do like the fact that it behaves more or less the same on Linux and Windows.

All in all a good effort guys but don't stop yet.

A look at Qt 4.6

Posted Dec 17, 2009 19:59 UTC (Thu) by oblio (guest, #33465) [Link]

"- missing basic features such as insert/overwrite mode"

Insert/overwrite mode is considered a gross misfeature by some. Like me. Very rarely useful, and it's not that hard to turn it on by accident.

QT Creator vs Emacs

Posted Dec 11, 2009 0:36 UTC (Fri) by juhl (subscriber, #33245) [Link]

I have to disagree. I still prefer Emacs.
Creator still chokes on too much valid C++, crashes too frequently and is pretty slow. No thanks. It gives me nothing that I don't already get (better) from Emacs...

QT Creator vs Emacs

Posted Dec 11, 2009 8:25 UTC (Fri) by boudewijn (subscriber, #14185) [Link]

Crashes? I've been using Qt Creator for about a year now, every day, on three platforms, for projects between 40,000 and 1,000,000 lines of code, and I've never had a crash since it came out of beta. Maybe it's because I freshly compile Qt Creator every morning after doing a git pull... And compared to, for instance, the speed with which Emacs fontifies some of the bigger legacy classes in my projects, Qt Creator is extremely fast. I've stopped using Emacs altogether for my C++ projects now, in fact.

And since nothing in Emacs can do the kind of smart code insight Qt Creator offers (well, KDevelop is even better at that, but KDevelop is still a beta), I've actually gained a lot in productivity.

So, if it's been some time since you last tried Qt Creator, like, since the first beta, give it another try.

QT Creator vs Emacs

Posted Dec 11, 2009 20:25 UTC (Fri) by ikm (subscriber, #493) [Link]

Emacs is too broad, scattered out thin, horizontally-oriented and lispy for me to be usable. It reminds me of a GTA-like sandbox game. There's a sandbox and then there are lisp scripts in it lying flatly. This is very different from Qt Creator -- the latter in much more vertical in its design, and it shows.

Anyway, it's still a matter of preferences. One should check out both, of course -- it's just that one would presume 'emacs' was tried (even at least once) by everybody here among LWN crowd already.

QT Creator vs Emacs

Posted Dec 13, 2009 18:26 UTC (Sun) by MarkWilliamson (guest, #30166) [Link]

"It reminds me of a GTA-like sandbox game."

That made my day!

QT Creator vs Emacs

Posted Dec 12, 2009 10:39 UTC (Sat) by kelvie (subscriber, #60620) [Link]

I still do use emacs, because my fingers' muscle memory refuses to use anything else, but I do agree for people that aren't tainted like me that Qt Creator is a better for developing Qt apps ...

You don't get odd behaviours in indentation such as indenting Q_OBJECT correctly, and I've never quite gotten semantic/CEDET working right with Qt projects.

Copyright © 2009, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds