The Qt toolkit is a C++ class library and a set of tools for building multiplatform
GUI programs using a “write once, compile anywhere” approach. Qt lets
programmers use a single source tree for applications that will run on Windows
95 to XP, Mac OS X, Linux, Solaris, HP-UX, and many other versions of
Unix with X11.A version of Qt is also available for Embedded Linux, with the
The purpose of this book is to teach you how to write GUI programs using Qt 3.
The book starts with “Hello Qt” and quickly moves on to more advanced topics,
such as creating custom widgets and providing drag and drop. The text is
complemented by a CDthat contains the source code of the example programs.
The CD also provides Qt and Borland C++ for Windows, Qt for Unix, and Qt
for Mac OS X. Appendix A explains how to install the software.
The book focuses on explaining good idiomatic Qt 3 programming techniques
rather than simply rehashing or summarizing Qt’s extensive online documentation.
And because we are involved in the development of Qt 4, we have tried
to ensure that most of what we teach here will still be valid and sensible for
It is assumed that you have a basic knowledge of C++. The code examples use
a subset of C++, avoiding many C++ features that are rarely needed when
programming Qt. In the few places where a more advanced C++ construct is
unavoidable, it is explained as it is used.
Qt made its reputation as a multiplatform toolkit, but because of its intuitive
and powerful API, many organizations use Qt for single-platform development.
Adobe PhotoshopAlbum is just one example of a mass-marketWindows
application written in Qt. Many sophisticated software systems in vertical
markets, such as 3D animation tools, digital film processing, electronic design
automation (for chip design), oil and gas exploration, financial services, and
medical imaging, are built with Qt. If you are making a living with a successful
Windows product written in Qt, you can easily create new markets in the
Mac OS X and Linux worlds simply by recompiling.
Qt is available under various licenses. If you want to build commercial
applications, you must buy a commercial license; if you want to build open
source programs,you can use a non-commercial Qt edition. (The editions of Qt
on the CD are non-commercial.) Qt is the foundation on which the K Desktop
Environment (KDE) and the many open source applications that go with it
In addition to Qt’s hundreds of classes, there are add-ons that extend Qt’s
scope and power. Some of these products, like the Qt/Motif integration module
and Qt Script for Applications (QSA), are supplied by Trolltech, while others
are provided by companies and by the open source community. See http://
www.trolltech.com/products/3rdparty/ for information on Qt add-ons. Qt also
has a well-established and thriving user community that uses the qt-interest
mailing list; see http://lists.trolltech.com/ for details.
The book is divided into two parts. Part I covers all the concepts and practices
necessary for programming GUI applications using Qt. Knowledge of this
part alone is sufficient to write useful GUI applications. Part II covers central
Qt topics in more depth and provides more specialized and advanced material.
The chapters of Part II can be read in any order, but they assume familiarity
with the contents of Part I.