Qt (toolkit)
In
computer programming,
Qt is a
cross-platform graphical
widget toolkit for the development of
GUI programs. Qt is most notably used in
KDE,
Qtopia and
OPIE. It is produced by the
Norwegian company
Trolltech, formerly Quasar Technologies. Trolltech insiders pronounce Qt as "cute".
Qt uses an extended version of the
C++ programming language, but
bindings exist for
Python,
Ruby,
C,
Perl and
Pascal. It runs on all major platforms, and has extensive
internationalization support. Non-GUI features include
SQL database access,
XML parsing,
thread management, and a unified cross-platform
API for file handling.
Qt is released by Trolltech on the following
platforms:
*
Qt/X11 — Qt for
X Window System*
Qt/Mac — Qt for Apple
Mac OS X*
Qt/Windows — Qt for
Microsoft Windows*
Qt/Embedded — Qt for embedded platforms (
PDA,
Smartphone, ...)
*
Qt/Jambi — Qt for
Java platform Development.
There are four
editions of Qt available on each of these platforms, namely:
*
Qt Console — edition for
non-GUI development.
*
Qt Desktop Light — entry level GUI edition, stripped of network and database support.
*
Qt Desktop — complete edition.
*
Qt Open Source Edition — complete edition, for open-source development.
The first three editions are released under a commercial license which permits
closed source development; while the Open Source edition is available under the
GPL license and additionally under the
Q Public License (QPL) for the Qt/X11 version.
In case of the X11 platform, the QPL allows the final application to be licensed under various open source licenses, such as the LGPL or the Artistic license. For the Windows and Mac OS X platforms, the GPL is the only Open Source license available so the applications developed with it must be GPL as well.
All editions support a wide range of compilers, including the
GCC C++ compiler. Official support for the
Visual Studio suite [
1] is, however, restricted to the commercial Qt/Windows edition. The
Q../Free project has released several patches [
2] which add support for Microsoft Visual Studio and Borland C++ Builder to the open-source version of Qt/Windows.
Trolltech released Qt 4 on
June 28,
2005 and introduced five new technologies in the framework:
*
Tulip A set of template container classes.
*
Interview A model/view architecture for item views.
*
Arthur A 2D painting framework.
*
Scribe A Unicode text renderer with a public API for performing low-level text layout.
*
MainWindow A modern action-based main window, toolbar, menu, and docking architecture.
Qt 4 is
dual-licensed under GPL and proprietary licenses on all supported platforms including Windows (while Qt/Windows 3.3 is only released under a proprietary license).
Qt 4.1, released on
December 19,
2005, introduced integrated
SVG Tiny support, a
PDF backend to Qt's printing system, and
a few other features.
Haavard Nord and
Eirik Chambe-Eng (the original developers of Qt and the CEO and President of Trolltech respectively) began development of "Qt" in
1991, three years before the company was incorporated as Quasar Technologies, then changed the name to Troll Tech, and then to Trolltech.
The toolkit was called Qt because the letter
Q looked beautiful in Haavard's
Emacs font, and T was inspired by
Xt, the X toolkit.
Controversy erupted around
1998 when it became clear that KDE was going to become one of the leading
desktop environments for
GNU/Linux. As KDE was based on Qt, many people in the
open source and free software movements were worried that an essential piece of one of their major operating systems would be proprietary.
This gave rise to two efforts: the
Harmony toolkit which sought to duplicate the Qt Toolkit under a
free software license and the
GNOME desktop that was meant to supplant KDE entirely. The GNOME Desktop uses the
GTK+ toolkit which was written for the
GIMP, and mainly uses the C programming language.
Until version 1.45, source code for Qt was released under the
FreeQt license — which was viewed as not compliant to the open source principle by the
Open Source Initiative and
Free Software Foundation because while the source was available it did not allow the redistribution of modified versions. With the release of version 2.0 of the toolkit, the license was changed to the
Q Public License (QPL), a
free software license but one regarded by the
Free Software Foundation as incompatible with the GPL. Compromises were sought between KDE and Trolltech wherein Qt would not be able to fall under a more restrictive license than the QPL, even if Trolltech was bought out or went bankrupt. This led to the creation of the
KDE Free Qt foundation, which guarantees that Qt would fall under a BSD license should no open source version of Qt be released during 12 months.
The first versions of Qt had only two flavours: Qt/X11 for Unix and Qt/Windows for the Windows platform. The Windows platform was only available under the commercial license. In the end of 2001, Trolltech released Qt 3.0 which added support for the Mac OS X platform. The Mac OS X support was available only in the commercial license, until June 2003, where Trolltech released the version 3.2 with Mac OS X support available under the GPL license.
In 2002 members of the
KDE on Cygwin project began porting the GPL licensed Qt/X11 code base to Windows [
3]. This was in response to Trolltech's refusal to license Qt/Windows under the GPL on the grounds that Windows was not an open-source platform [
4][
5]. The project achieved reasonable success although it never reached production quality. Qt/Windows 4 was released under the GPL by Trolltech in June 2005. Qt4 now supports the same set of platforms in the Open Source editions as in the commercial edition.
The innovation of Qt when it was first released relied on a few key concepts.
Complete abstraction of the GUI
Qt uses its own paint engine and controls. It emulates the look of the different platforms it runs on. This made theporting work easier because very few classes in Qt depended really on thetarget platform. The drawback is that Qt had to emulate precisely the look ofthe different platforms. This drawback however no longer applies because thelatest versions of Qt use the native styles API of the different platforms todraw the Qt controls.
Other portable graphical toolkits have made a different design decision, such as
wxWidgets and the Java based
SWT[
6] which use the toolkit of the target platform for their implementation.
Meta Object Compiler
Known as the
moc, this is a tool that one must run onthe sources of a Qt program prior to compiling it. The tool will generate "MetaInformation" about the classes used in the program. This meta information isused by Qt to provide programming features not available in C++:
Introspection,
signal/slot system.
The use of an additional tool has been criticised by part ofthe C++ community, stating that Qt programming is making a "moc"ery of C++. In particular,the choice of an implementation based on macros has been criticized for itsabsence of type safety. Some people confused the macros with new C++ keywords, and criticized the pollution of the namespace. This is viewed by Trolltech as a necessary trade-off to provide introspection and dynamically generated slots or signals. Further, when Qt 1.x was released, consistency between compiler template implementations could not be relied upon.
The use of
moc allows for a very flexible signal/slot messaging system, so that multiple signals can connect to multiple slots, to other signals, or to slots on different threads, in a "callback safe" manner.
*
Q../Windows Edition history, 5 June 2006
*
E-mail to the kde-cygwin mailing list by Chris January, 4 February 2003
*
Qt Non-commercial FAQ, 5 October 2003
*
Widget toolkit*
wxWidgets*
List of software development kits*
Qt Homepage*
Qtopia.net Qtopia Community Site*
Qt community site*
The GPL Versus Qt "War" (19.2.3) (regarding Qt licensing from before version 2.2)
*
How Qt's proprietary license agreement works*
The Independent Qt Tutorial*
An Introduction to Design Patterns in C++ with Qt4. Full text of a Prentice Hall book teaching C++ programming from the ground up, using Qt 4.1
*
Using ODBC in QT*
#qt irc.freenode.net site