An Intro to Qt 3.0

"Write once, use everywhere." Most programmers associate that
slogan -- and its problems -- with Java. Fans of the Qt graphical user
interface (GUI) toolkit, however, argue that version 3 of Qt is the
library that truly lives up to the promise. This profile of the
latest release examines Qt's "universality" in five aspects:

Platform availability

Licensing clarity

Ease of learning

Unicode compatibility

Feature applicability

Full portability

Many GUI coders share the belief that only native toolkits are
"enough": fast enough, feature-rich enough, or reliable enough.
Portable GUI schemes, according to this folklore, are inherently
too slow and/or clumsy to yield high-quality applications.

Trolltech AS's Qt is highly responsive and visually
attractive. Similar versions have been available
for both Unix and Windows for several years. With the release of
3.0, Trolltech fully supports Qt under Mac OS, Unix, Windows, and
even X11-free embedded Linux.

Rainer Goebel, general manager of medical imaging specialists
Brain Innovation of Maastricht, summarizes his company's view:
"We ended up choosing Qt due to its consistent object-oriented
approach, combined with its elegant signal-slot mechanism. The
knowledge that Qt was used to develop KDE, one of the two major
modern Linux/Unix desktops, also helped in the decision process.
Finally, no other approach achieved the same speed of the
executable combined with a native look-and-feel as Qt for all
considered platforms. ... The port to the Mac platform was
possible within a single day."

Many Trolltech customers had been pleading for Qt for the Mac, and one
of the major uncertainties about release 3.0 was the level of
polish this implementation would exhibit. Official availability
on October 15, 2001, the Mac version of Qt calmed many of these concerns. Qt/Mac has
the Aqua look-and-feel, is fully carbonized, and, among other
features, supports OpenGL.

It's more difficult to judge the success of another 3.0
innovation. Trolltech emphasizes the importance of
portability to its customers. To simplify its implementation
and maintenance chores, 3.0 begins to define a "framework"
that extends beyond Qt's classic GUI widget set. This framework
includes cross-platform abstractions of input/output functionality,
database access, and several other common areas of computing. Use
of the framework eases portability.

That's the intent, in any case. At least a handful of Qt
programmers already make extensive use of the framework. However,
a more elaborate "component" model originally projected for the 3.0 release
didn't meet Trolltech's standards for quality. The component
model has been held back to ripen for a later release.

Licensing simplification

Ideologic controversy, especially from Linux zealots, marked much
of Qt's history. Trolltech is a for-profit company, and hopes to derive a large fraction of its total revenues
from Qt licenses. This has been a sore point for those who
prefer free licenses.

Over the last few years, however, Trolltech has relaxed and simplified
the conditions of several of its licenses. With 2.2, the Qt
Free Edition became available under either the General
Public License (GPL) or Q Programming License, with
full source code available for any X11-based implementation.
The Free Edition of Qt can be used to develop free software, or to run
software legally developed by others.

A binary-only non-commercial edition for Microsoft Windows is
compatible only with Microsoft Visual Studio version 6 and is targeted
at Windows-based "hobbyist" programmers.

Development of proprietary applications is generally done
under Trolltech's Professional or Enterprise licenses. A single-user
Professional license typically starts around USD$1,500, for any
of the desktop platforms.

How to learn Qt

Along
with the quality of the library in a narrow sense, scores of
programmers cite the documentation Trolltech makes available
for downloading as a key factor in Qt's usability.
Developers have responded favorably to Trolltech's accurate and readable documentation.

The quality of this documentation also helps those with an interest in Qt to quickly determine for themselves
Qt's applicability to their individual needs.
If a typical sales presentation teaches about a product, Qt's
documentation instructs in the product itself.

As advantageous as this emphasis on good documentation has
been for Trolltech, it hasn't met the needs of all customers.
Qt suffered in its early history from the lack of an authoritative
book. That situation also improved over the last few years,
with the publication in 1999 of Programming Qt,
and in 2000 of Teach Yourself Qt Programming in 24
Hours. A second edition of the Programming Qt, covering 3.0
functionality, is due out in spring, and a third book, GUI Programming with Python: Qt Edition, should
appear in print before New Year's.

Qt and Unicode

Is the 3.0 version an advantage for those already using Qt? Yes. Its support for new platforms, new licensing structure, and quick learning curve all add to the Qt experience. The new release also includes plenty of improvements for experienced programmers used to working on a fixed platform.

Perhaps there have been too many improvements. Boudewijn Rempt, author
of GUI Programming with Python: Qt Edition, recently wrote about his
disappointment at how incompatible the 3.0 and 2.0 versions are.
While the conceptual model, for example, is unchanged, "There are
gratuitous, but ubiquitous, changes like renaming
setBackgroundColor to setEraseColor."

For him, though, along with many other programmers, "The absolute
killer feature ... is the great Unicode support. As long as you
have a font that contains the glyph, Qt will display any Unicode
character. The translation support given by Qt Linguist is
mouth-watering, too."

Think of Unicode as another kind of portability Qt 3.0 provides. Along
with availability on different operating systems, Qt 3.0 makes it
easy to program applications that display and accept
not only English and the human tongues that most resemble English,
but really almost the full range of written languages, including Korean,
Urdu, and Arabic.

Qt Linguist is only one of a suite of tools designed to
help managers, translators, and programmers rework existing
applications to serve speakers of a variety of human languages,
rather than just one.

More features

Another improvement in version 3.0 is the power of the QTextEdit and QTable widgets. These
encapsulate common user-interface patterns, and simplify
the task of programming popular visual designs. Trolltech's online
examples, for instance, include a complete 60-line program that
creates and manages a sparse trillion-cell table.

In many ways, Qt's functionality has stabilized. Several
3.0 changes are more matters of taste than unequivocal improvements.
The 3.0 release of Qt Designer, Qt's visual development
tool, is more conventional and less strict in its object orientation
than it was in the 2.0 version. The emphasis in 3.0 on "property" access rather than
get/set methods is similar -- and closer to what other development
environments offer, and less like the rigorous C++ style popular
among many experienced Qt programmers.

If you're not already a Qt programmer, you'll want to give the toolkit
a chance. There's lots to like about the library, and the accurate documentation make it easy to get started.
For ease of learning and high productivity, consider "PyQt"
(Python-plus-Qt), rather than the raw C++ binding. OReillyNet.com and
OnLAMP.com have already published several technical notes that will help
you get to know Qt better, including Stephen Figgins' recent review
of GUI Programming for Python: Qt Edition, and the my Qt notes page.