SKIP THE SHIPPING
Use code NOSHIP during checkout to save 40% on eligible eBooks, now through January 5. Shop now.
Register your product to gain access to bonus material or receive a coupon.
"In addition to being a mighty fine Qt hacker, Ward is also a very nice guy with a good sense of humor. I think that's a perfect combination for writing a book like this one."Eirik Eng, President, Trolltech AS
State-of-the-art graphical applications for Linux, UNIX, and Windows!
For software developers, it's the holy grail: write one state-of-the-art graphical application that reaches all your key markets: Linux, UNIX, and Windows. Qt Programming for Linux and Windows shows experienced C++ programmers how to do just that, using the powerful new Qt toolkits-the same tools used to build the #1 Linux graphical user interface, KDE!
Long-time Qt developer Patrick Ward provides exclusive, in-depth coverage of Qt programming in Microsoft Windows environments: interfacing with Microsoft APIs, working with DDE servers and COM/DCOM, even Qt 2 development for Windows 2000.
If you're ready to build great graphical applications, build them fast, and run them anywhere, one book will show you how: Qt Programming for Linux and Windows 2000!
CD-ROM INCLUDEDThe accompanying CD-ROM contains the new Qt 2.1 Free Edition distribution, value-added Qt toolkit extensions, sample code, and more.
Click here for a sample chapter for this book: 0130270016.pdf
I. GETTING STARTED.
1. Introduction to Qt.What the Toolkit Does. What the Toolkit Includes. Using The Qt Online Reference Documentation. Qt Portability. Microsoft Windows Logo Program. Building And Installing Qt. Qt Licensing.
2. Creating Your First Qt Applications.Hello World Example. Contact List Interface Example. Stack vs Heap. Qt Toolkit Basics. QApplication Class. QApplication's Purposes. Color Management. QWidget Class. Parent/Child Relationship. Widget Flags. QObject Class. Signals and Slots vs Callbacks. Signal/Slot Disadvantages. Summary.
II. QT WIDGETS AND CONVENIENCE CLASSES.
3. Visual Objects.User Interaction Objects. Buttons. Predefined Dialogs. Functional Grouping. Layout and Geometry Management. Lists, Tables, and List Items. Composite Widget Support. Text Input. Numeric Input. Scrolling. Split Panes and Tabs. Tooltips and What's This Support. Program Output Objects. Color and Palette Support. Graphic Image Output Support. Text Support. Output Widgets.
4. Qt Convenience Objects.Events And Event Parameters. QChildEvent. QCloseEvent. QCustomEvent. QDragEnterEvent. QDragLeaveEvent. QDragMoveEvent. QDropEvent. QEvent. QFocusEvent. QHideEvent. QKeyEvent. QMouseEvent. QMoveEvent. QPaintEvent. QResizeEvent. QShowEvent. QTimerEvent. QWheelEvent. Input and Output Classes. QAccel. QAsyncIO. QBuffer. QDataStream. QDataPump. QDataSink. QDataSource. QDir. QFile. QFileInfo. QIODevice. QIODeviceSource. QTextIStream. QTextOStream. QTextStream. QSocketNotifier. Collections, Arrays, and Linked-Lists. QArray. QAsciiCache. QAsciiCacheIterator. QAsciiDict. QAsciiDictIterator. QBitArray. QByteArray. QCache. QCacheIterator. QCollection. QDict. QDictIterator. QIntCache. QIntCacheIterator. QIntDict. QIntDictIterator. QIntValidator. QList. QListIterator. QMap. QMapConstIterator. QMapIterator. QPtrDict. QPtrDictIterator. QQueue. QSortedList. QStack. QStrList and QStrIList. QStrListIterator. QStringList. QValueList. QValueListConstIterator. QValueListIterator. QValueStack. QVector. Text Handling. QChar. QClipboard. QConstString. QCString. QDoubleValidator. QRegExp. QString. QTextCodec. QTextDecoder. QTextEncoder. QTranslator. QValidator. Date and Time. QDate. QDateTime. QTime. Miscellaneous. QGuardedPtr. QMimeSource. QMimeSourceFactory. QPoint. QPointArray. QRect. QSignal. QSignalMapper. QSize. QTimer. QVariant. QWMatrix. Summary.
5. The Qt Namespace and Qt Extensions.Qt Class. Qt Extensions. OpenGL Extension. Networking Support.
III. DEVELOPING PROFESSIONAL QT APPLICATIONS.
6. Internationalization.Use QString. QObject::tr(). findtr Utility. msg2qm Utility. mergetr Utility. Input Methods. Summary.
7. Platform-Independent Projects.TMAKE Utility.
8. Object Reuse Considerations.Keep It Simple And To The Point. Always Consider Performance. Know Your Compiler. Assume Nothing. Use Slots For Exposed void-return Methods.
9. Dynamic and Static Linkage.Big Programs. Compatibility. Possible Solutions. Configuration Management. Total Static Linkage. Mixed Static/Dynamic Linkage. Summary.
10. Debugging Projects.Documentation and Training Bugs. User Perception Defects. Software Defects. Defect Event Capture. Core Dump Analysis (Linux/Unix only). Dr Watson (Windows only). Using A Debugger.
11. Rapid Application Development.Qt Architect. QtEZ. KDevelope. Ebuilder.
12. Windows 2000 Topics.DDE Server Class. Multimedia Support. Summary.
13. How To Learn More.This book is a guide to writing applications for Linux, Microsoft NT 4.0, Windows 2000, Windows 95, and Windows 98, using the Qt software toolkit from Trolltech AS. As any respectable programming guide should, it provides a working knowledge of the Qt software distribution and the objects, widgets, and conveniences that the Qt toolkit provides. In addition, it explores some aspects of Qt programming for enterprise application development that are not obvious from the toolkit vendor's documentation.
AudienceThis book is for C++ programmers and students that want to write effective application software using the Qt toolkit. The focus is primarily on platform-independent software, but some platform-specific topics are unavoidably covered.
AssumptionsThis book is not a reference manual for the Qt objects and widgetsTrolltech has done an excellent job of providing reference documentation in HTML and Adobe Postscript formats. Their documentation is included with both the Qt-Free edition and the
Qt-Professional edition licenses, and is available from the Troll web site. http://www.trolltech.com
This book is written for both the experienced C++ programmer and the knowledgeable beginner. It is assumed the reader is familiar with standard C++ data types and how new data types are created. The reader should be familiar with the basic concepts of object-oriented (OO) design and implementation, particularly the concept of object inheritance. I have avoided using multiple inheritance in my examples for purposes of clarity, but the reader is encouraged to experiment.
While the title of this book implies a focus on Linux and Windows 2000, the actual scope is much larger. Most of the examples, as well as the code provided on the CD, will compile and function correctly on virtually any platform that Qt will.
If you are an experienced Microsoft developer, some of the coding style presented here may cause mild confusion. Please remember that with a few exceptions, the code presented in this book is intended for cross-platform use. As a result, you will seldom see references to DWORD, LPVOID, and LPSTR data types because they are undefined on platforms outside the Microsoft arena, and since most of the standard Unix data types are compatible with Windows development, they are used instead. The "correctness" of either is purely subjective.
Microsoft platform-specific examples require a Qt-Professional license. Licensing can be obtained directly from Trolltech, and is discussed in some detail in Chapter 1. While Qt software development can be done using the Borland compiler and tools, it is far more common for developers to use Microsoft Visual C++. As a result, it is assumed that the Windows developer has access to Microsoft Visual Studio 6.0 and VC98 (Visual C++).
It is possible, in theory, to compile and use Qt-Free edition applications on a Windows platform, using the Cygnus Win32 implementation, the ming32 compiler distribution, the X11R6.3 development kit for Win32, and an appropriate X server. Since this is an incredibly esoteric environment, it isn't addressed by any of the examples in this book. However, any of the Linux examples should work, assuming you succeed in compiling the Qt-Free edition with the Cygnus compiler distributionsomething I haven't tried yet.
Linux development can be accomplished using the Qt-Free edition. You will need a C++ compiler. This book assumes a generic gcc/g++ distribution (gcc-2.95 was used for the examples) from the Free Software Foundation (FSF), in the assumption that it is a reasonably low common denominator.
Many other platforms are supported out-of-the-box by Troll. I have had virtually no trouble using Qt on HP/UX or AIX.
How This Book Is OrganizedThis book is organized into three parts. Part One is an introduction to the Qt toolkit. It provides some initial programming examples, and discusses some of the unique features that set Qt development apart from other toolkits. Part Two is a detailed discussion of toolkit components. Part Three discusses project-level considerations and debugging techniques.
Appendix A maps the contents of the accompanying CD-ROM. Appendix B (and the index) help to map the contents of this book.
The Accompanying CD-ROMThe CD-ROM that comes with this book is in ISO9660 format with Joliet extensions (long filenames). The root directory of the CD-ROM contains a number of subdirectories with names that are (hopefully) descriptive of their contents. The only file in the root directory is a file named "contents.txt" that, surprisingly, contains a text map of what the CD-ROM contains, along with some brief descriptions of those contents.