70
Main Window Responsibilities............................................................................................................................................... 239
Data Container Responsibilities............................................................................................................................................. 244
Saving and Loading Binary Files............................................................................................................................................ 250
Saving and Loading Text Files................................................................................................................................................ 258
Saving and Loading XML Files............................................................................................................................................... 266
Summary.................................................................................................................................................................................. 275
Exercise.................................................................................................................................................................................... 276
Intermediate GUI Programming............................................................. 276
Layouts and Multiple Documents............................................................................................................................................... 277
Layout Policies......................................................................................................................................................................... 278
Tab Widgets and Stacked Widgets.......................................................................................................................................... 279
Splitters................................................................................................................................................................................... 288
Single Document Interface (SDI)............................................................................................................................................ 291
Multiple Document Interface (MDI)...................................................................................................................................... 298
Summary................................................................................................................................................................................. 308
Exercise................................................................................................................................................................................... 309
Events, the Clipboard, and Drag & Drop.................................................................................................................................... 310
The Event Handling Mechanism............................................................................................................................................. 310
Reimplementing Event Handlers............................................................................................................................................ 312
Using the Clipboard................................................................................................................................................................. 318
Drag and Drop......................................................................................................................................................................... 319
Summary................................................................................................................................................................................. 325
Exercise.................................................................................................................................................................................... 326
Custom Widgets.......................................................................................................................................................................... 327
Using Widget Style Sheets...................................................................................................................................................... 328
Creating Composite Widgets................................................................................................................................................... 331
Subclassing Built-in Widgets.................................................................................................................................................. 333
Subclassing QWidget............................................................................................................................................................... 335
Summary.................................................................................................................................................................................. 351
Exercise.................................................................................................................................................................................... 352
Item-Based Graphics................................................................................................................................................................... 353
Custom and Interactive Graphics Items................................................................................................................................. 355
Animation and Complex Shapes............................................................................................................................................. 373
Summary................................................................................................................................................................................. 382
Exercise................................................................................................................................................................................... 384
Rich Text and Printing................................................................................................................................................................ 384
Rich Text Editing..................................................................................................................................................................... 386
Printing Documents................................................................................................................................................................ 402
Summary.................................................................................................................................................................................. 415
Exercise.................................................................................................................................................................................... 416
Model/View Programming.......................................................................................................................................................... 417
Using the Convenience Item Widgets..................................................................................................................................... 419
Creating Custom Models......................................................................................................................................................... 427
Creating Custom Delegates..................................................................................................................................................... 439
Summary................................................................................................................................................................................. 446
Exercise.................................................................................................................................................................................... 447
Databases.................................................................................................................................................................................... 447
Connecting to the Database.................................................................................................................................................... 448
Executing SQL Queries........................................................................................................................................................... 449
Using Database Form Views................................................................................................................................................... 454
Using Database Table Views................................................................................................................................................... 460
Summary.................................................................................................................................................................................. 473
Exercise.................................................................................................................................................................................... 474
Advanced GUI Programming................................................................... 475
Advanced Model/View Programming........................................................................................................................................ 475
Custom Views.......................................................................................................................................................................... 476
Generic Delegates.................................................................................................................................................................... 483
Representing Tabular Data in Trees....................................................................................................................................... 492
Summary................................................................................................................................................................................. 506
Exercise................................................................................................................................................................................... 506
Rapid GUI Programming with Python and Qt: The Definitive Guide to PyQt Programming
Rapid GUI Programming with Python and Qt: The Definitive Guide to PyQt Programming
Rapid GUI Programming with Python and Qt: The Definitive Guide to PyQt Programming
By Mark Summerfield ISBN: 9780132354189 Publisher: Prentice Hall
Prepared for Paul Waddell, Safari ID: pwaddell@u.washington.edu
Print Publication Date: 2007/10/19
User number: 905221 Copyright 2007, Safari Books Online, LLC.
This PDF is exclusively for your use in accordance with the Safari Terms of Service. No part of it may be reproduced or transmitted in any form by any means without the prior
written permission for reprints and excerpts from the publisher. Redistribution or other use that violates the fair use priviledge under U.S. copyright laws (see 17 USC107) or that
otherwise violates the Safari Terms of Service is strictly prohibited.