C++ GUI programming with Qt 4 [2nd ed., 8th printing] 9780132354165, 0132354160, 1411411471

The Only Official, Best-Practice Guide to Qt 4.3 Programming Using Trolltech's Qt you can build industrial-strength

1,329 262 10MB

English Pages XXI, 718 Seiten zahlreiche Illustrationen, Diagramme [746] Year 2008;2013

Report DMCA / Copyright

DOWNLOAD FILE

C++ GUI programming with Qt 4 [2nd ed., 8th printing]
 9780132354165, 0132354160, 1411411471

Table of contents :
Cover......Page 1
Contents......Page 6
Series Editor’s Note......Page 12
Foreword......Page 14
Preface......Page 16
Acknowledgments......Page 18
A Brief History of Qt......Page 20
Part I: Basic Qt......Page 24
Hello Qt......Page 26
Making Connections......Page 28
Laying Out Widgets......Page 29
Using the Reference Documentation......Page 33
Subclassing QDialog......Page 36
Signals and Slots in Depth......Page 43
Rapid Dialog Design......Page 46
Shape-Changing Dialogs......Page 54
Dynamic Dialogs......Page 61
Built-in Widget and Dialog Classes......Page 62
3. Creating Main Windows......Page 68
Subclassing QMainWindow......Page 69
Creating Menus and Toolbars......Page 73
Setting Up the Status Bar......Page 78
Implementing the File Menu......Page 80
Using Dialogs......Page 86
Storing Settings......Page 92
Multiple Documents......Page 94
Splash Screens......Page 97
The Central Widget......Page 100
Subclassing QTableWidget......Page 101
Loading and Saving......Page 107
Implementing the Edit Menu......Page 110
Implementing the Other Menus......Page 114
Subclassing QTableWidgetItem......Page 118
Customizing Qt Widgets......Page 128
Subclassing QWidget......Page 130
Integrating Custom Widgets with Qt Designer......Page 140
Double Buffering......Page 144
Part II: Intermediate Qt......Page 162
Laying Out Widgets on a Form......Page 164
Stacked Layouts......Page 170
Splitters......Page 172
Scrolling Areas......Page 175
Dock Windows and Toolbars......Page 177
Multiple Document Interface......Page 180
Reimplementing Event Handlers......Page 190
Installing Event Filters......Page 195
Staying Responsive during Intensive Processing......Page 198
8. 2D Graphics......Page 202
Painting with QPainter......Page 203
Coordinate System Transformations......Page 208
High-Quality Rendering with QImage......Page 216
Item-Based Rendering with Graphics View......Page 218
Printing......Page 240
Enabling Drag and Drop......Page 250
Supporting Custom Drag Types......Page 255
Clipboard Handling......Page 260
10. Item View Classes......Page 262
Using the Item View Convenience Classes......Page 263
Using Predefined Models......Page 270
Implementing Custom Models......Page 275
Implementing Custom Delegates......Page 289
11. Container Classes......Page 296
Sequential Containers......Page 297
Associative Containers......Page 305
Generic Algorithms......Page 308
Strings, Byte Arrays, and Variants......Page 310
12. Input/Output......Page 318
Reading and Writing Binary Data......Page 319
Reading and Writing Text......Page 324
Traversing Directories......Page 330
Embedding Resources......Page 331
Inter-Process Communication......Page 332
13. Databases......Page 338
Connecting and Querying......Page 339
Viewing Tables......Page 345
Editing Records Using Forms......Page 347
Presenting Data in Tabular Forms......Page 353
14. Multithreading......Page 362
Creating Threads......Page 363
Synchronizing Threads......Page 366
Communicating with the Main Thread......Page 372
Using Qt’s Classes in Secondary Threads......Page 379
Writing FTP Clients......Page 382
Writing HTTP Clients......Page 391
Writing TCP Client–Server Applications......Page 394
Sending and Receiving UDP Datagrams......Page 404
16. XML......Page 410
Reading XML with QXmlStreamReader......Page 411
Reading XML with DOM......Page 418
Reading XML with SAX......Page 423
Writing XML......Page 427
Tooltips, Status Tips, and “What’s This?” Help......Page 430
Using a Web Browser to Provide Online Help......Page 432
Using QTextBrowser as a Simple Help Engine......Page 434
Using Qt Assistant for Powerful Online Help......Page 437
Part III: Advanced Qt......Page 440
18. Internationalization......Page 442
Working with Unicode......Page 443
Making Applications Translation-Aware......Page 446
Dynamic Language Switching......Page 452
Translating Applications......Page 458
Using Qt Style Sheets......Page 462
Subclassing QStyle......Page 477
Drawing Using OpenGL......Page 494
Combining OpenGL and QPainter......Page 500
Doing Overlays Using Framebuffer Objects......Page 507
21. Creating Plugins......Page 514
Extending Qt with Plugins......Page 515
Making Applications Plugin-Aware......Page 525
Writing Application Plugins......Page 528
22. Application Scripting......Page 532
Overview of the ECMAScript Language......Page 533
Extending Qt Applications with Scripts......Page 542
Implementing GUI Extensions Using Scripts......Page 546
Automating Tasks through Scripting......Page 553
Interfacing with Native APIs......Page 566
Using ActiveX on Windows......Page 570
Handling X11 Session Management......Page 582
24. Embedded Programming......Page 590
Getting Started with Qt/Embedded Linux......Page 591
Customizing Qt/Embedded Linux......Page 593
Integrating Qt Applications with Qtopia......Page 594
Using Qtopia APIs......Page 599
Appendixes......Page 610
A. Obtaining and Installing Qt......Page 612
B. Building Qt Applications......Page 616
C. Introduction to Qt Jambi......Page 628
D. Introduction to C++ for Java and C# Programmers......Page 646
A......Page 688
B......Page 689
C......Page 691
D......Page 694
E......Page 697
F......Page 699
H......Page 701
I......Page 702
L......Page 705
M......Page 706
N......Page 708
O......Page 709
P......Page 710
Q......Page 713
R......Page 727
S......Page 729
T......Page 735
U......Page 738
W......Page 739
Z......Page 741

Polecaj historie