C++ GUI Programming with Qt3Prentice Hall Professional, 2004 - 440 páginas Preface The Qt toolkit is a C++ class library and a set of tools for building multiplatformGUI programs using a "write once, compile anywhere" approach. Qt letsprogrammers use a single source tree for applications that will run on Windows95 to XP, Mac OS X, Linux, Solaris, HP-UX, and many other versions ofUnix with X11.A version of Qt is also available for Embedded Linux, with thesame API. 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 iscomplemented 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 Qtfor Mac OS X. Appendix A explains how to install the software. The book focuses on explaining good idiomatic Qt 3 programming techniquesrather than simply rehashing or summarizing Qt's extensive online documentation.And because we are involved in the development of Qt 4, we have triedto ensure that most of what we teach here will still be valid and sensible forQt 4. It is assumed that you have a basic knowledge of C++. The code examples usea subset of C++, avoiding many C++ features that are rarely needed whenprogramming Qt. In the few places where a more advanced C++ construct isunavoidable, it is explained as it is used. Qt made its reputation as a multiplatform toolkit, but because of its intuitiveand powerful API, many organizations use Qt for single-platform development.Adobe PhotoshopAlbum is just one example of a mass-marketWindowsapplication written in Qt. Many sophisticated software systems in verticalmarkets, such as 3D animation tools, digital film processing, electronic designautomation (for chip design), oil and gas exploration, financial services, andmedical imaging, are built with Qt. If you are making a living with a successfulWindows product written in Qt, you can easily create new markets in theMac OS X and Linux worlds simply by recompiling. Qt is available under various licenses. If you want to build commercialapplications, you must buy a commercial license; if you want to build opensource programs,you can use a non-commercial Qt edition. (The editions of Qton the CD are non-commercial.) Qt is the foundation on which the K DesktopEnvironment (KDE) and the many open source applications that go with itare built. In addition to Qt's hundreds of classes, there are add-ons that extend Qt'sscope and power. Some of these products, like the Qt/Motif integration moduleand Qt Script for Applications (QSA), are supplied by Trolltech, while othersare provided by companies and by the open source community. See http://www.trolltech.com/products/3rdparty/ for information on Qt add-ons. Qt alsohas a well-established and thriving user community that uses the qt-interestmailing list; see http://lists.trolltech.com/ for details. The book is divided into two parts. Part I covers all the concepts and practicesnecessary for programming GUI applications using Qt. Knowledge of thispart alone is sufficient to write useful GUI applications. Part II covers centralQt 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 familiaritywith the contents of Part I. |
Conteúdo
Getting Started | 3 |
Making Connections | 5 |
Using the Reference Documentation | 8 |
Creating Dialogs | 11 |
Signals and Slots in Depth | 18 |
Rapid Dialog Design | 21 |
ShapeChanging Dialogs | 28 |
Dynamic Dialogs | 33 |
Supporting Custom Drag Types | 220 |
Advanced Clipboard Handling | 224 |
InputOutput | 227 |
Reading and Writing Text | 234 |
Handling Files and Directories | 237 |
InterProcess Communication | 239 |
Container Classes | 243 |
Lists | 247 |
Creating Main Windows | 39 |
Subclassing QMainWindow | 40 |
Creating Menus and Toolbars | 44 |
Implementing the File Menu | 49 |
Setting Up the Status Bar | 56 |
Using Dialogs | 58 |
Storing Settings | 63 |
Multiple Documents | 64 |
Splash Screens | 67 |
Implementing Application Functionality | 69 |
Subclassing QTable | 70 |
Loading and Saving | 77 |
Implementing the Edit Menu | 80 |
Implementing the Other Menus | 84 |
Subclassing QTableltem | 88 |
Creating Custom Widgets | 97 |
Subclassing QWidget | 99 |
Integrating Custom Widgets with Qt Designer | 108 |
Double Buffering | 112 |
Intermediate Qt | 133 |
Layout Management | 135 |
Splitters | 140 |
Widget Stacks | 144 |
Scroll Views | 145 |
Dock Windows | 150 |
Multiple Document Interface | 152 |
Event Processing | 163 |
Installing Event Filters | 168 |
Staying Responsive During Intensive Processing | 171 |
2D and 3D Graphics | 175 |
Graphics with QCanvas | 185 |
Printing | 198 |
Graphics with OpenGL | 209 |
Drag and Drop | 215 |
Maps | 249 |
PointerBased Containers | 251 |
QString and QVariant | 254 |
Databases | 261 |
Presenting Data in Tabular Form | 266 |
Creating DataAware Forms | 275 |
Networking | 283 |
Using QHttp | 289 |
TCP Networking with QSocket | 291 |
UDP Networking with QSocketDevice | 301 |
XML | 307 |
Reading XML with DOM | 312 |
Writing XML | 316 |
Internationalization | 319 |
Making Applications TranslationAware | 323 |
Dynamic Language Switching | 329 |
Translating Applications | 334 |
Providing Online Help | 339 |
Using QTextBrowser as a Simple Help Engine | 342 |
Using Qt Assistant for Powerful Online Help | 346 |
Multithreading | 349 |
Communicating with the GUI Thread | 359 |
Using Qts Classes in NonGUI Threads | 363 |
PlatformSpecific Features | 367 |
Using ActiveX | 371 |
Session Management | 384 |
Appendices | 391 |
Installing Qt | 393 |
Installing QtWindows | 394 |
Installing QtMac | 395 |
Installing QtX11 | 397 |
Qts Class Hierarchy | 399 |
403 | |