文件名称:Rapid GUI Programming with Python and Qt
文件大小:5.43MB
文件格式:PDF
更新时间:2019-07-10 03:33:10
QT,GUI
Rapid GUI programming with Python and Qt 1 Contents 8 Foreword 14 Introduction 16 Part I: Python Programming 22 Chapter 1. Data Types and Data Structures 24 Executing Python Code 25 Variables and Objects 27 Numbers and Strings 30 Collections 44 Built-in Functions 52 Summary 56 Exercises 57 Chapter 2. Control Structures 60 Conditional Branching 61 Looping 64 Functions 70 Exception Handling 81 Summary 87 Exercises 87 Chapter 3. Classes and Modules 90 Creating Instances 92 Methods and Special Methods 94 Inheritance and Polymorphism 114 Modules and Multifile Applications 119 Summary 122 Exercises 123 Part II: Basic GUI Programming 124 Chapter 4. Introduction to GUI Programming 126 A Pop-Up Alert in 25 Lines 127 An Expression Evaluator in 30 Lines 131 A Currency Converter in 70 Lines 136 Signals and Slots 142 Summary 151 Exercise 152 Chapter 5. Dialogs 154 Dumb Dialogs 156 Standard Dialogs 162 Smart Dialogs 169 Summary 177 Exercise 178 Chapter 6. Main Windows 180 Creating a Main Window 181 Handling User Actions 205 Summary 216 Exercise 217 Chapter 7. Using Qt Designer 220 Designing User Interfaces 223 Implementing Dialogs 231 Testing Dialogs 236 Summary 238 Exercise 239 Chapter 8. Data Handling and Custom File Formats 242 Main Window Responsibilities 244 Data Container Responsibilities 250 Saving and Loading Binary Files 255 Saving and Loading Text Files 264 Saving and Loading XML Files 271 Summary 280 Exercise 281 Part III: Intermediate GUI Programming 282 Chapter 9. Layouts and Multiple Documents 284 Layout Policies 285 Tab Widgets and Stacked Widgets 287 Splitters 295 Single Document Interface (SDI) 298 Multiple Document Interface (MDI) 305 Summary 315 Exercise 316 Chapter 10. Events, the Clipboard, and Drag and Drop 318 The Event-Handling Mechanism 318 Reimplementing Event Handlers 320 Using the Clipboard 325 Drag and Drop 327 Summary 332 Exercise 333 Chapter 11. Custom Widgets 336 Using Widget Style Sheets 337 Creating Composite Widgets 340 Subclassing Built-in Widgets 341 Subclassing QWidget 343 Summary 360 Exercise 361 Chapter 12. Item-Based Graphics 364 Custom and Interactive Graphics Items 366 Animation and Complex Shapes 383 Summary 393 Exercise 394 Chapter 13. Rich Text and Printing 396 Rich Text Editing 397 Printing Documents 413 Summary 426 Exercise 427 Chapter 14. Model/View Programming 428 Using the Convenience Item Widgets 430 Creating Custom Models 438 Creating Custom Delegates 451 Summary 457 Exercise 458 Chapter 15. Databases 460 Connecting to the Database 461 Executing SQL Queries 461 Using Database Form Views 466 Using Database Table Views 472 Summary 485 Exercise 486 Part IV: Advanced GUI Programming 488 Chapter 16. Advanced Model/View Programming 490 Custom Views 491 Generic Delegates 498 Representing Tabular Data in Trees 507 Summary 520 Exercise 520 Chapter 17. Online Help and Internationalization 524 Online Help 525 Internationalization 527 Summary 534 Exercise 535 Chapter 18. Networking 536 Creating a TCP Client 538 Creating a TCP Server 544 Summary 549 Exercise 549 Chapter 19. Multithreading 552 Creating a Threaded Server 554 Creating and Managing Secondary Threads 559 Implementing a Secondary Thread 567 Summary 572 Exercise 573 This Is Not Quite the End 574 Appendix A. Installing 576 Installing on Windows 576 Installing on Mac OS X 581 Installing on Linux and Unix 585 Appendix B. Selected PyQt Widgets 590 Appendix C. Selected PyQt Class Hierarchies 596 Index 600 A 601 B 602 C 604 D 606 E 608 F 610 G 611 H 611 I 612 J 613 K 613 L 614 M 615 N 616 O 616 P 617 Q 618 R 630 S 631 T 637 U 639 V 639 W 640 X 640 Y 640 Z 640