Thursday, May 31, 2007

Trolltech's Qt 4.3.0 really begins to dazzle

It's not hard to impress me with new visual software. I love eye candy, the flashier the better. So it should come as no surprise that I'm awfully impressed with the latest version of the Qt framework, 4.3.0. I installed it on three systems for a quick and dirty evaluation; algol (my XP Core Duo notebook), europa (my OpenSuse 10.2 Athlon XP system), and my daughter's Toshiba Satellite A135 notebook running Vista Home Premium. I've got screen shots from XP and Suse, but I didn't bother to do a Vista capture. I'll explain why later.

Installing Qt Windows Open Source Edition is dead simple. Download and click on the installation binary. It will install the complete Qt set of tools and examples, and if you don't have it installed already, it will also install a copy of MinGW to compile applications with Qt. Note that the Windows version of the Qt framework does not have to be compiled. Everything is pre-built and ready to use. The screen shot below is the application QtDemo with three of the demo applications launched and arranged around it.

One really interesting new feature is the integration of Javascript into the framework. You can see the Javascript demo running in the very small window at the bottom of the screen. It's displaying an analog clock. That clock is being setup in Javascript, and rendered using calls to Qt's underlying graphics primitives. Very slick.

Installing Qt X11 Open Source Edition and getting it to work takes a little more effort. Qt is the foundation for KDE, so it's usually already installed (minus the examples and demos). To get the absolute latest you download the sources, run configure, make, and make install. No big deal, but with this framework it takes some number of hours on europa. Once built and installed it's then available for demonstrations and further development.

When I built Qt 4.3.0 I decided to build it with the latest version of gcc, 4.2.0. I figured I'd test the latest gcc's C++ compilation capabilities with a reasonably non-trivial set of source code. I did that, it succeeded in building, and then QtDemo failed to execute. It died with a signal 11. You can see where it segfaulted (via gdb) in the window below.

Well, I knew I was pushing my luck by compiling the latest Qt with the latest gcc. So I simply changed my environment to use the older gcc (the default 4.1.2 for Suse 10.2) and moved the binaries and installation built with gcc 4.2.0 out of the way, as it were. Then I uncompressed Qt again, and rebuilt everything with gcc 4.1.2. Sure enough, QtDemo ran just fine (as you can see below). I don't know if I should file a bug report with Trolltech or the gcc developers, but right now it looks like Qt 4.3.0 has compilation issues with gcc 4.2.0. I'd have to do a fair amount of debugging to see if there really is a compiler problem or if there's a linker issue between executables and libraries built with gcc 4.2.0 linked against other libraries in the Suse distribution built with gcc 4.1.2.

Once I got Qt rebuilt with 4.1.2 and installed I fired up QtDemo and started four of its demo applications. Three of them match the same demo apps I started on Windows. The forth was a little Bit Torrent client in the upper left corner of the screen. I decided to download the latest Fedora release with it, Fedora 7 Live CD. And it worked. Yes, it's very primitive compared to Azureus and KTorrent, but the fact it was included demonstrates the depth and breadth of the Qt demonstration applications as well as the power of the framework.

I should also note that all the full-screen screen shots were made with the Screenshot demo app (Desktop | Screenshot).


The best 'experience' was under Windows XP. Every application was pre-built and every demo ran, especially the OpenGL demos. What's more, the bouncing green balls only appeared on the QtDemo main page when it ran under Windows XP. That effect was missing on both the Suse and Vista installations.

Under OpenSuse 10.2, everything built except the OpenGL demos. I'm still trying to find out why. OpenGL demos have built under every other Qt release, such as 4.2.3. Other than OpenGL everything built and runs just fine. What was nice is that it picked up my OpenSuse KDE theme and used it where appropriate. Everything ran as smoothly under OpenSuse as it did Windows XP. That's interesting to me as OpenSuse runs on a single core Athlon XP (32-bit), while my Windows XP system is powered by a Core Duo. It will take more sophisticated applications to begin to see differences between the two platforms.

Of the three, the Vista installation was the least satisfying. None of the OpenGL demos worked. I'm none too impressed with the Vista theme. It looks too much like a bad Beryl theme. That's why I didn't bother to grab any screen shots from Vista. It would have been pointless.

I expect this version of Qt to really shine on Linux, Windows and Mac OS X. If you haven't stepped up from Qt 3 to Qt 4, then this is the version to seriously consider switching to. And if you've got an older version of Qt 4, then this is most definitely the version to update to. I'll have more to write about this release of Qt in the near future.


  1. Hi Bill,
    Read your post on Qt with interest.
    I recently intalled Qt4.3.0 on
    my Fedora 7 VM Appliance that has
    gcc 4.1.2. I get seg fault using
    "qtdemo" and the error is the same
    as you got while using gcc 4.2.0:
    >> QMetaObject::activate...
    >> ...kernel/qobject.cpp:2985
    >> 2985 void QMetaObject...
    Do you have any suggestions on
    how I diagnose this seg fault?

  2. I read this entry with great interest. Thank you.


All comments are checked. Comment SPAM will be blocked and deleted.

Note: Only a member of this blog may post a comment.