Part I.  Design Patterns and Qt

Table of Contents

1. C++ Introduction
1.1. Overview of C++
1.2. A Brief History of C++
1.3. C++ First Example
1.4. Standard Input and Output
1.4.1. Exercises: Standard Input and Output
1.5. Introduction to Functions
1.5.1. Exercises: Introduction to Functions
1.6. qmake, Project Files, and Makefile
1.6.1. #include: Finding Header Files
1.7. Getting Help Online
1.8. Strings
1.9. Streams
1.10. File Streams
1.10.1. Exercises: File Streams
1.11. Qt Dialogs for User Input/Output
1.11.1. Exercises: Qt Dialogs for User Input/Output
1.12. Identifiers, Types, and Literals
1.12.1. Exercises: Identifiers, Types, and Literals
1.13. C++ Simple Types
1.13.1. main, and Command-Line Arguments
1.13.2. Arithmetic
1.13.3. Exercises: C++ Simple Types
1.14. The Keyword const
1.15. Pointers and Memory Access
1.15.1. The Unary Operators & and *
1.15.2. Operators new and delete
1.15.3. Exercises: Pointers and Memory Access
1.16. Reference Variables
1.17. const* and *const
1.18. Review Questions
1.18.1. Points of Departure
2. Top of the class
2.1. First, There Was struct
2.2. Class Definitions
2.3. Member Access Specifiers
2.4. Encapsulation
2.5. Introduction to UML
2.5.1. UML Relationships
2.6. Friends of a Class
2.7. Constructors
2.8. Destructors
2.9. The Keyword static
2.10. Class Declarations and Definitions
2.11. Copy Constructors and Assignment Operators
2.12. Conversions
2.13. const Member Functions
2.14. Subobjects
2.15. Exercise: Classes
2.16. Review Questions
3. Introduction to Qt
3.1. Style Guidelines, Naming Conventions
3.2. The Qt Core Module
3.2.1. Streams and Dates
3.3. QtCreator – An IDE for Qt Programming
3.4. Exercises: Introduction to Qt
3.5. Review Questions
3.5.1. Points of Departure
4. Lists
4.1. Introduction to Containers
4.2. Iterators
4.2.1. QStringList and iteration
4.2.2. QDir, QFileInfo, QDirIterator
4.3. Relationships
4.3.1. Relationships Summary
4.4. Exercise: Relationships
4.5. Review Questions
5. Functions
5.1. Overloading Functions
5.1.1. Exercises: Overloading Functions
5.2. Default (Optional) Arguments
5.3. Operator Overloading
5.3.1. Exercises: Operator Overloading
5.4. Parameter Passing by Value
5.5. Parameter Passing by Reference
5.6. References to const
5.7. Function Return Values
5.8. Returning References from Functions
5.9. Overloading on const
5.9.1. Exercises: Overloading on const
5.10. inline Functions
5.10.1. Inlining Versus Macro Expansion
5.11. Functions with Variable-Length Argument Lists
5.12. Exercise: Encryption
5.13. Review Questions
6. Inheritance and Polymorphism
6.1. Simple Derivation
6.1.1. Inheritance Client Code Example
6.1.2. Exercises: Simple Derivation
6.2. Derivation with Polymorphism
6.2.1. Exercises: Derivation with Polymorphism
6.3. Derivation from an Abstract Base Class
6.4. Inheritance Design
6.5. Overloading, Hiding, and Overriding
6.6. Constructors, Destructors, and Copy Assignment Operators
6.7. Processing Command-Line Arguments
6.7.1. Derivation and ArgumentList
6.7.2. Exercises: Processing Command-Line Arguments
6.8. Containers
6.9. Managed Containers, Composites and Aggregates
6.9.1. Exercises: Managed Containers, Composites and Aggregates
6.10. Containers of Pointers
6.10.1. Exercises: Containers of Pointers
6.11. Review Questions
7. Libraries and Design Patterns
7.1. Building and Reusing Libraries
7.1.1. Organizing Libraries: Dependency Management
7.1.2. Installing Libraries
7.2. Exercise: Installing Libraries
7.3. Frameworks and Components
7.4. Design Patterns
7.4.1. Serializer Pattern: QTextStream and QDataStream
7.4.2. AntiPatterns
7.4.2.1. Points of Departure
7.5. Review Questions
8. QObject, QApplication, Signals, and Slots
8.1. Values and Objects
8.2. Composite Pattern: Parents and Children
8.2.1. Finding Children
8.2.2. QObject's Child Managment
8.2.2.1. Exercises: QObject's Child Managment
8.3. QApplication and the Event Loop
8.4. Q_OBJECT and moc: A checklist
8.5. Signals and Slots
8.5.1. Points of Departure
8.6. QObject Lifecycle
8.7. QTestLib
8.8. Exercises: QObject, QApplication, Signals, and Slots
8.9. Review Questions
9. Widgets and Designer
9.1. Widget Categories
9.2. Designer Introduction
9.3. Dialogs
9.4. Form Layout
9.5. Icons, Images and Resources
9.6. Layout of Widgets
9.6.1. Spacing, Stretching, and Struts
9.6.2. Size Policy and Size Hint
9.6.3. Exercises: Layout of Widgets
9.7. Designer Integration with Code
9.7.1. QtCreator Integration with Designer
9.8. Exercise: Input Forms
9.9. The Event Loop: Revisited
9.9.1. QTimer
9.9.1.1. Exercises: QTimer
9.10. Paint Events, Drawing Images
9.11. Review Questions
10. MainWindows and Actions
10.1. QActions, QMenus, and QMenuBars
10.1.1. QActions, QToolbars, and QActionGroups
10.1.2. Exercise: CardGame GUI
10.2. Regions and QDockWidgets
10.3. QSettings: Saving and Restoring Application State
10.4. Clipboard and Data Transfer Operations
10.5. The Command Pattern
10.5.1. QUndoCommand and Image Manipulation
10.5.1.1. Exercises: QUndoCommand and Image Manipulation
10.6. tr() and Internationalization
10.7. Exercises: MainWindows
10.8. Review Questions
11. Generics and Containers
11.1. Generics and Templates
11.1.1. Function Templates
11.1.1.1. Exercises: Function Templates
11.1.2. Class Templates
11.1.3. Exercises: Generics and Templates
11.2. Generics, Algorithms, and Operators
11.2.1. Exercises: Generics, Algorithms, and Operators
11.3. Sorted Map Example
11.4. Function Pointers and Functors
11.5. Flyweight Pattern: Implicitly Shared Classes
11.6. Exercise: Generics
11.7. Review Questions
12. Meta Objects, Properties, and Reflective Programming
12.1. QMetaObject - The Meta Object Pattern
12.2. Type Identification and qobject_cast
12.3. Q_PROPERTY Macro - Describing QObject Properties
12.4. QVariant Class: Accessing Properties
12.5. Dynamic Properties
12.6. MetaTypes, Declaring and Registering
12.7. invokeMethod()
12.8. Exercises: Reflection
12.9. Review Questions
13. Models and Views
13.1. Model-View-Controller (MVC)
13.2. Qt Models and Views
13.2.1. QFileSystemModel
13.2.2. Multiple Views
13.2.3. Delegate Classes
13.3. Table Models
13.3.1. Standard or Abstract?
13.3.2. Editable Models
13.3.3. Sorting and Filtering
13.4. Tree Models
13.4.1. Trolltech Model Testing Tool
13.5. Smarter Pointers
13.6. Exercises: Models and Views
13.7. Review Questions
14. Validation and Regular Expressions
14.1. Input Masks
14.1.1. Exercises: Input Masks
14.2. Validators
14.2.1. Exercises: 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. Subclassing QValidator
14.6. Exercises: Validation and Regular Expressions
14.7. Review Questions
15. Parsing XML
15.1. The Qt XML Parsers
15.2. SAX Parsing
15.3. XML, Tree Structures, and DOM
15.3.1. DOM Tree Walking
15.3.2. Generation of XML with DOM
15.4. XML Streams
15.5. Review Questions
16. More Design Patterns
16.1. Creational Patterns
16.1.1. Abstract Factory
16.1.2. Abstract Factories and Libraries
16.1.3. qApp and Singleton Pattern
16.1.4. Benefits of Using Factories
16.1.5. Exercises: Creational Patterns
16.2. Memento Pattern
16.2.1. Exporting to XML
16.2.2. Importing Objects with an Abstract Factory
16.3. The Façade Pattern
16.4. Review Questions
16.4.1. Points of Departure
17. Concurrency
17.1. QProcess and Process Control
17.1.1. Processes and Environment
17.1.2. Qonsole: Writing an Xterm in Qt
17.1.3. Qonsole with Keyboard Events
17.1.4. Exercises: QProcess and Process Control
17.2. QThread and QtConcurrent
17.2.1. Thread Safety and QObjects
17.2.2. Parallel Prime Number Calculators
17.2.3. Concurrent Map/Reduce Example
17.3. Exercises: QThread and QtConcurrent
17.4. Review Questions
18. Database Programming
18.1. QSqlDatabase: Connecting to SQL from Qt
18.2. Queries and Result Sets
18.3. Database Models
18.4. Review Questions