![](https://csdnimg.cn/release/download_crawler_static/4851353/bg13.jpg)
ptg
2 Introduction
plaining many details and classes that are already familiar to Qt programmers,
such as using layouts, creating actions, connecting signals and slots, and so on,
leaving the book free to focus on the less familiar material.
Of course, no single volume book can realistically do justice to Qt’s more than
700 public classes—almost 800 in Qt 4.6—and its much more than one million
words of documentation, so no attempt is made to do so here. Instead this
book provides explanations and examples of how to use some of Qt’s most
powerful features, complementing the reference documentation rather than
duplicating it.
The book’s chapters have been designed to be as self-contained as possible, so
it is not necessary to read the book from beginning to end in chapter order. To
support this, where particular techniques are used in more than one chapter,
the explanation is given in just one place and cross-references are given else-
where. Nonetheless, if you plan to read odd chapters out of order, I recommend
that you at least do an initial skim read of the entire book, since chapters and
sections devoted to one particular topic may of necessity have material relating
to other topics. Also, I have tried to include lots of small details from Qt’s API
throughout, to make the book’s content richer, and to show as many features as
possible in context, so useful information appears throughout.
As with all my previous books, the quoted code snippets are of “live code”,
that is, the code was automatically extracted from the examples’ source files
and directly embedded in the PDF that went to the publisher—so there are
no cut and paste errors, and the code works. The examples are available from
www.qtrac.eu/aqpbook.html
and are licensed under the GPL (GNU General
Public License version 3). The book presents more than twenty-five examples
spread over more than 150
.hpp
and
.cpp
files, and amounting to well over
20 000 lines of code. Although all of the most important pieces of code are quot-
ed and explained in the book, there are numerous small details that there isn’t
space to cover in the book itself, so I recommend downloading the examples
and at least reading the source code of those examples that are in your areas
of particular interest. In addition to the examples, some modules containing
commonly used functionality are also provided. These all use the
AQP
names-
pace to make them easy to reuse, and they are all introduced in the first couple
of chapters, and then used throughout the book.
All the examples—except for those in the last chapter which use Qt 4.6-specific
features—have been tested with Qt 4.5 and Qt 4.6 on Linux, Mac OS X, and
Windows. Applications built using Qt 4.5 will run unchanged with Qt 4.6, and
later Qt 4.x versions, because Qt maintains backward compatibility between
minor releases. However, where there are differences between the two Qt
versions, the book shows and explains the Qt 4.6-specific approach, while the
source code uses
#if QT_VERSION
so that the code compiles with either version
with the best practices used for each. A few examples may work with earlier
Qt 4.x versions, particularly Qt 4.4, and some examples could be backported to