Part II.  Higher Level Programming

Abstract

This part of the book contains in-depth discussions of Qt, some popular design patterns used in application development, how to maximize code reuse through inheritance, using and creating libraries, proper documentation practices, test frameworks, properties and reflection, event-based programming, XML parsing, and GUI building blocks.

Table of Contents

7. Libraries
7.1. Code Containers
7.2. Building and Reusing Libraries
7.2.1. Organizing Libraries: Dependency Management
7.2.2. Installing Libraries
7.2.2.1. Points of Departure
7.3. Installing Libraries: A Lab Exercise
7.4. Frameworks and Components
7.5. Review Questions
8. Introduction to Design patterns
8.1. Anti-patterns
8.2. The Visitor Pattern
8.2.1. Directories and Files: QDir and QFileInfo
8.2.2. Customizing the Visitor using Inheritance
8.2.3. Exercises: The Visitor Pattern
8.2.4. QDirIterator and the Iterator pattern
8.3. Review Questions
9. QObject
9.1. QObject's Child Managment
9.1.1. Exercises: QObject's Child Managment
9.2. Parents and Children
9.2.1. Finding Children
9.2.2. Exercises: Parents and Children
9.3. QApplication and the Event Loop
9.3.1. Layouts: A First Look
9.3.2. Connecting to slots
9.3.3. Signals and Slots
9.3.3.1. Signal Mappers
9.3.3.2. Exercises: Signals and Slots
9.4. Q_OBJECT and moc: A checklist
9.5. Values and Objects
9.6. Exercises: QObject
9.7. tr() and Internationalization.
9.8. Review Questions
9.9. Points of Departure
10. Generics and Containers
10.1. Generics and Templates
10.1.1. Function Templates
10.1.1.1. Exercises: Function Templates
10.1.2. Class Templates
10.1.3. Exporting template functions
10.1.4. Exercises: Generics and Templates
10.2. Containers
10.3. Managed Containers, Composites and Aggregates
10.3.1. Exercises: Managed Containers, Composites and Aggregates
10.4. Generics, Algorithms, and Operators
10.4.1. Exercises: Generics, Algorithms, and Operators
10.5. Serializer Pattern
10.5.1. Exercises: Serializer Pattern
10.6. Sorted Map example
10.7. Flyweight pattern: Implicitly Shared Classes
10.7.1. Points of Departure
10.7.2. Exercises: Flyweight pattern: Implicitly Shared Classes
10.8. Exercise: QSet and QMap
10.9. Review Questions
11. Qt GUI Widgets
11.1. Widget Categories
11.2. QMainWindow and QSettings
11.2.1. QSettings: Saving and Restoring Application State
11.3. Dialogs
11.3.1. Input Dialogs and Widgets
11.3.2. Exercises: Dialogs
11.4. Images and Resources
11.5. Layout of Widgets
11.5.1. Spacing, Stretching, and Struts
11.5.2. Moving Widgets across Layouts
11.5.3. Exercises: Layout of Widgets
11.6. QActions, QMenus, and QMenuBars
11.6.1. QActions, QToolbars, and QActionGroups
11.6.2. Exercises: QActions, QMenus, and QMenuBars
11.6.3. Exercise: CardGame GUI
11.6.4. Points of Departure
11.7. Regions and QDockWidgets
11.8. Views of a QStringList
11.8.1. Exercises: Views of a QStringList
11.9. Qt Designer
11.10. Review Questions
11.10.1. Points of Departure
12. Concurrency
12.1. QProcess and Process Control
12.1.1. Processes and Environment
12.1.2. Qonsole: Writing an Xterm in Qt
12.1.3. Qonsole with Keyboard Events
12.1.4. Exercises: QProcess and Process Control
12.2. Threads and QThread
12.2.1. QPixmap and QThread Animation Example: Movie Player
12.2.2. Movie Player with QTimer
12.2.3. Multiple Threads, Queues, and Loggers Example: Giant
12.2.4. Thread Safety and QObjects
12.2.5. Exercises: Threads and QThread
12.3. Summary: QProcess and QThread
12.4. Review Questions
13. Models and Views
13.1. M-V-C: What about the Controller?
13.2. Qt 4 Models and Views
13.2.1. QStandardItemModel and Multiple Views
13.3. Table Models
13.4. Tree Models
13.4.1. Extended Tree Widget Items
13.4.1.1. Exercises: Extended Tree Widget Items
13.5. Form Models and Views
13.5.1. Form Models
13.5.2. Designer Forms and QDataWidgetMapper
13.5.2.1. Points of Departure
13.5.2.2. Exercises: Designer Forms and QDataWidgetMapper
13.6. Review Questions
13.7. Points of Departure
14. Validation and Regular Expressions
14.1. Input Masks
14.2. Validators
14.3. Regular Expressions
14.3.1. Regular Expression Syntax
14.3.2. Regular Expressions: Phone Number Recognition
14.3.3. Exercises: Regular Expressions
14.4. Regular Expression Validation
14.5. Exercises: Validation and Regular Expressions
14.6. Review Questions
15. Parsing XML
15.1. The Qt XML Module
15.2. Event-Driven parsing
15.3. XML, Tree Structures, and DOM
15.3.1. Visitor Pattern: DOM Tree Walking
15.3.2. Generation of XML with DOM
15.3.3. Exercises: XML, Tree Structures, and DOM
15.4. Review Questions
16. Meta Objects, Properties, and Reflective Programming
16.1. QMetaObject - The Meta Object pattern
16.2. Type Identification and qobject_cast
16.3. Q_PROPERTY Macro - Describing QObject Properties
16.4. QVariant Class: Accessing Properties
16.5. DataObject: An Extension of QObject
16.6. Dynamic Properties
16.7. MetaTypes
16.8. Review Questions
17. More Design Patterns
17.1. Creational Patterns
17.1.1. Abstract Factory
17.1.2. Abstract Factories and Libraries
17.1.3. qApp and Singleton pattern
17.1.4. Creation Rules and Friend Functions
17.1.5. Benefits of Using Factories
17.1.6. Exercises: Creational Patterns
17.2. Memento Pattern
17.2.1. Exporting to XML
17.2.2. Importing Objects with an Abstract Factory
17.3. The Façade Pattern
17.3.1. Functional Façade
17.3.2. Smart Pointers: auto_ptr
17.3.3. FileTagger: Façade Example
17.4. Review Questions
17.4.1. Points of Departure
18. Database Programming
18.1. Intro to MySQL
18.2. Connecting to MySQL from Qt
18.3. Queries and Result Sets
18.4. Long Running Threads and the Command Pattern
18.5. Database Models
18.6. Review Questions