Jump to content
Nytro

Introduction to Design Patterns in C++ with Qt4

Recommended Posts

Introduction to Design Patterns in C++ with Qt4

Alan Ezust

Paul Ezust

cover.png

Abstract

C++ is taught "The Qt way", with an emphasis on design patterns, and re-use of open source libraries and tools. By the end of the book, the reader should have a deep understanding of both the language and libraries, as well the design patterns used in developing software with them.

Table of Contents

Preface
Acknowledgments
Rationale for the Book
I. Introduction to C++ and Qt 4

1. C++ Introduction

1.1. Overview of C++
1.2. A Brief History of C++
1.3. C++ First Example
1.4. Input and Output

1.4.1. Exercises: Input and Output

1.5. qmake, Project Files, and Makefile

1.5.1. #include: Finding Header Files

1.6. Getting Help Online
1.7. Strings
1.8. Streams
1.9. File Streams

1.9.1. Exercises: File Streams

1.10. Qt dialogs for user input/output

1.10.1. Exercises: Qt dialogs for user input/output

1.11. Identifiers, Types, and Literals

1.11.1. Exercises: Identifiers, Types, and Literals

1.12. C++ Simple Types

1.12.1. main, and Command Line Arguments
1.12.2. Arithmetic
1.12.3. Exercises: C++ Simple Types

1.13. The Keyword const
1.14. Pointers and Memory access

1.14.1. The Unary Operators & and *
1.14.2. Operators new and delete
1.14.3. Exercises: Pointers and Memory access

1.15. Reference Variables
1.16. const* and *const
1.17. Review Questions

1.17.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. Qt Creator - An IDE for Qt Programming
2.6. Introduction to UML

2.6.1. UML Relationships

2.7. Friends of a Class
2.8. Constructors
2.9. Destructors
2.10. The Keyword static
2.11. Class Declarations and Defintions
2.12. Copy Constructors and Assignment Operators
2.13. Conversions
2.14. const Member Functions
2.15. Subobjects
2.16. Exercise: Classes
2.17. Review Questions

3. Introduction to Qt

3.1. Style Guidelines, Naming Conventions

3.1.1. Points of Departure

3.2. The Qt Core Module

3.2.1. Streams and Dates
3.2.2. Exercises: The Qt Core Module

3.3. Review Questions

3.3.1. Points of Departure

4. Lists

4.1. Introduction to Containers
4.2. Iterators

4.2.1. QStringList and iteration

4.3. Relationships
4.4. Exercise: Relationships
4.5. Review Questions

5. Functions

5.1. Function Declarations
5.2. Overloading Functions

5.2.1. Exercises: Overloading Functions

5.3. Default (Optional) Arguments
5.4. Operator Overloading

5.4.1. Exercises: Operator Overloading

5.5. Parameter Passing by Value
5.6. Parameter Passing by Reference
5.7. References to const
5.8. Function Return Values
5.9. Returning References from Functions
5.10. Overloading on const

5.10.1. Exercises: Overloading on const

5.11. inline Functions

5.11.1. Inlining versus Macro Expansion

5.12. Functions with Variable-length Argument Lists
5.13. Exercise: Encryption
5.14. Review Questions

6. Inheritance and Polymorphism

6.1. Simple Derivation

6.1.1. Inheritance Client Code Example

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.8. Exercises: Inheritance and Polymorphism
6.9. Review Questions

6.9.1. Points of Departure

II. Higher Level Programming

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 Iterator Pattern

8.2.1. Directories and Files: QDir and QFileInfo
8.2.2. Customizing FileVisitor using Inheritance
8.2.3. Exercises: The Iterator 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.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. Exercises: Signals and Slots

9.4. Q_OBJECT and moc: A checklist

9.4.1. Points of Departure

9.5. Values and Objects
9.6. Exercises: QObject
9.7. tr() and Internationalization.
9.8. Review Questions

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. 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.1.1. Points of Departure

11.6.2. Exercises: QActions, QMenus, and QMenuBars
11.6.3. Exercise: CardGame GUI

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

14. Validation and Regular Expressions

14.1. Validators
14.2. Regular Expressions

14.2.1. Regular Expression Syntax
14.2.2. Regular Expressions: Phone Number Recognition
14.2.3. Exercises: Regular Expressions

14.3. Regular Expression Validation
14.4. Exercises: Validation and Regular Expressions
14.5. 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. Iterator 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. 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.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

III. C++ Language Reference

19. Types and Expressions

19.1. Operators

19.1.1. Table of Operators

19.2. Evaluation of Logical Expressions
19.3. Enumerations
19.4. Signed and Unsigned Integral Types

19.4.1. Exercises: Signed and Unsigned Integral Types

19.5. Standard Expression Conversions

19.5.1. Exercises: Standard Expression Conversions

19.6. Explicit Conversions
19.7. Safer ANSI C++ Typecast operators

19.7.1. static_cast and const_cast

19.7.1.1. Exercises: static_cast and const_cast

19.7.2. reinterpret_cast
19.7.3. Why not use C-style casts?

19.8. Overloading special operators

19.8.1. Conversion Operators
19.8.2. Vectors and operator[]
19.8.3. The Function-Call operator()

19.9. Runtime Type Identification (RTTI)

19.9.1. typeid operator

19.10. Member Selection operators
19.11. Exercises: Types and Expressions
19.12. Review Questions

20. Scope and Storage Class

20.1. Declarations and Definitions
20.2. Identifier Scope

20.2.1. Default Scope of Identifiers - A Summary
20.2.2. File Scope versus Block Scope and operator::

20.2.2.1. Exercises: File Scope versus Block Scope and operator::

20.3. Storage Class

20.3.1. Globals, static, and QObject

20.3.1.1. Globals and const

20.3.2. Exercises: Storage Class

20.4. Namespaces

20.4.1. Anonymous Namespaces
20.4.2. Open Namespaces
20.4.3. namespace, static objects and extern

20.5. Review Questions

21. Statements and Control Structures

21.1. Statements
21.2. Selection Statements

21.2.1. Exercises: Selection Statements

21.3. Iteration

21.3.1. Exercises: Iteration

21.4. Review Questions

22. Memory Access

22.1. Pointer Pathology
22.2. Further Pointer Pathology with Heap Memory
22.3. Memory Access Summary
22.4. Introduction to Arrays
22.5. Pointer Arithmetic
22.6. Arrays, Functions, and Return Values
22.7. Different kinds of arrays
22.8. Valid Pointer Operations
22.9. What happens if new fails?

22.9.1. set_new_handler() : Another Approach To new Failures
22.9.2. Using set_new_handler and bad_alloc
22.9.3. Checking for null: new(nothrow)

22.10. Chapter Summary
22.11. Review Questions

23. Inheritance in Detail

23.1. virtual pointers, virtual tables
23.2. Polymorphism and virtual destructors
23.3. Multiple Inheritance

23.3.1. Multiple Inheritance Syntax
23.3.2. Multiple Inheritance with Abstract Interfaces

23.3.2.1. Points of Departure

23.3.3. Resolving Multiple Inheritance Conflicts

23.3.3.1. virtual Inheritance
23.3.3.2. virtual Base Classes

23.4. public, protected, and private derivation
23.5. Review Questions

IV. Programming Assignments

24. MP3 jukebox Assignments

24.1. Phonon Setup
24.2. Playlist
24.3. Playlists
24.4. Source Selector
24.5. Star Delegates
24.6. Filtering Views
24.7. File Tree SideBar
24.8. AutoDJ

A. C++ Reserved keywords
B. Standard Headers
C. The Development Environment

C.1. make and Makefile
C.2. The Preprocessor: For #including Files
C.3. Understanding the Linker

C.3.1. Common Linker Error Messages

C.4. Debugging

C.4.1. Building a Debuggable Target

C.4.1.1. Exercises: Building a Debuggable Target

C.4.2. gdb Quickstart
C.4.3. Finding Memory Errors

C.5. Qt Assistant and Designer
C.6. Open Source development tools, Libraries, IDEs.

D. Alan's quickstart guide to Debian for programmers.

D.1. The apt system
D.2. update-alternatives

E. C++/Qt Setup

E.1. C++/Qt Setup: Open Source Platforms
E.2. C++/Qt Setup: Win32
E.3. C++/Qt Setup: Mac OSX

F. Errata
Bibliography
Index

Download, capitole:

http://cartan.cas.suffolk.edu/oopdocbook/opensource/index.html

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...