An Introduction to Design Patterns in C++ with Qt 4

3.87 avg rating
( 15 ratings by GoodReads )
 
9780131879058: An Introduction to Design Patterns in C++ with Qt 4

Learn C++, Patterns, and Qt 4 Cross-Platform Development

Master C++ and design patterns together, using the world's leading open source framework for cross-platform development: Qt 4.

An Introduction to Design Patterns in C++ with Qt 4 is a complete tutorial and reference that assumes no previous knowledge of C, C++, objects, or patterns. You'll walk through every core concept, one step at a time, learning through an extensive collection of Qt 4.1-tested examples and exercises.

By the time you're done, you'll be creating multithreaded GUI applications that access databases and manipulate XML files--applications that run on platforms including Windows, Linux, Unix, and Mac OS X. Best of all, you'll be writing code that's efficient, reusable, and elegant.

  • Learn objects fast: classes, inheritance, polymorphism, and more
  • Master powerful design patterns
  • Discover efficient high-level programming techniques using libraries, generics, and containers
  • Build graphical applications using Qt widgets, models, and views
  • Learn advanced techniques ranging from multithreading to reflective programming
  • Use Qt's built-in classes for accessing MySQL data
  • Includes a complete C++ language reference

"synopsis" may belong to another edition of this title.

About the Author:

<> Alan Ezust received his M.Sc in Computer Science from McGill, and has delivered courses on object oriented programming and APIs for over 15 years. He is an instructor and courseware developer at ics.com, leading provider of Trolltech-certified Qt training and services throughout North America.


Paul Ezust chairs Suffolk University's Department of Mathematics and Computer Science, and has taught computer science for nearly thirty years. He has done extensive consulting and contract programming.



Excerpt. © Reprinted by permission. All rights reserved.:

C++ had been in use for many years before it was standardized in 1989, which makes it a relatively mature language compared to others that are in popular use today. It is a very important language for building fast, efficient, mission-critical systems. C++ is also one of the most flexible languages around, giving developers many choices of programming styles for use in high-level GUI code as well as low-level device drivers.

For a few years in the early '90s, C++ was the most popular object-oriented (OO) language in use, and many computer science (CS) students were introduced to object-oriented programming (OOP) via C++. This was because C++ provided a relatively easy transition to OOP for C programmers, and many CS professors had been teaching C previously.

Starting around 1996, Java gained favor over C++ as the first OO language for students to learn. There are a number of reasons that Java gained so much popularity.

  • The language itself is simpler than C++.
  • The language has built-in garbage collection, so programmers do not need to concern themselves with memory de-allocation.
  • A standard set of GUI classes is included in the development kit.
  • The built-in String class supports Unicode.
  • Multithreading is built into the language.
  • It is easier to build and "plug in" Java Archives (JARs) than it is to recompile and relink libraries.
  • Many Web servers provide Java APIs for easy integration.
  • Java programs are platform independent (Wintel, Solaris, MacOS, Linux, *nix, etc.).

Many of Java's benefits listed above can be achieved with C++ used in conjunction with Qt 4.

Qt provides a comprehensive set of GUI classes that run faster, look better, and are more flexible than Java's Swing classes.Signals and slots are easier to use than (ActionEventKey)Listener interfaces in Java.

Qt 4 has a plugin architecture that makes it possible to load code into an application without recompiling or relinking.Qt 4 provides foreach, which makes iteration through collections simpler to read and write.

Although Qt does not provide garbage collection, there are a variety of alternatives one can use to avoid the need to delete heap objects directly.

  1. Containers (see Section 10.2)
  2. Parents and children (see Section 9.2)
  3. auto_ptr (see Section 16.3.2)
  4. QPointer (see Section 19.9).
  5. Subobjects (see Section 2.8)
  6. Stack objects (see Section 20.3)

Using C++ with Qt comes very close to Java in ease of use, comprehensiveness, and convenience. It significantly exceeds Java in the areas of speed and efficiency, making everything from processing-intensive server applications to high-speed graphics-intensive games possible.

Another benefit of learning C++ with Qt comes from Qt's widespread use in open-source projects. There is already a great wealth of free open-source code that you can learn from, reuse, and perhaps help to improve.

How to Use This Book

Part I contains an introduction to C++, UML, and the Qt core. This part is designed to avoid forward referencing as much as possible, and it presents the topics in an order and a level of detail that should not overwhelm someone who is new to C/C++.

In Part II, you will find higher-level programming ideas, Qt modules, and design patterns. Here we present paradigm-shifting ways of writing code and organizing objects in a modular fashion.

For completeness and for reference, Part III covers in more depth some of the "dry" but important C++ features that were introduced in Part I. By the time the reader has reached this point, these ideas should be a lot easier to understand.At the end of each chapter, you will find exercises and review questions. Most of the programming exercises have solutions available on our Web site. For the questions, if the answers are not in the preceding chapter, then often there are pointers on where to find them. If this book is used for a course, these questions could be asked by the student or by the teacher, in the classroom or on an exam.

Source code files for all the examples in this book are contained in the file src.tar.gz, which can be downloaded from http://oop.mcs.suffolk.edu/dist.

A Note about Formats and Book Production

What you are reading now is only one of a number of possible versions of this text available. Because the document was originally written in XML, using a "literal programming" style, we can generate a variety of different versions (bulleted slides, paragraphed textbook, with or without solutions, etc.) in a variety of different formats (html, pdf, ps, htmlhelp).

Each programming example is extracted from working source code. The Web version provides a hyperlink from each code excerpt to its full source file. This makes it very easy to try the examples yourself. The text and listings in the Web version also contain hyperlinks from each library ClassName to its class documentation page.

We wrote the original manuscript using jEdit and gnu-emacs, marking it up with a modified DocBook/XML syntax that we converted into pure DocBook/XML using a custom XML processor called Slacker's DocBook written in Python. Most of the original diagrams were produced with Umbrello or Dia, but a couple were produced with Doxygen and Dot. The final book was typeset in QuarkXPress. We generate many different versions (overhead slides, textbooks, labs, and solutions) of this text for our own use, some in HTML, some in PostScript, and some in PDF.The XML and image processors we used were Apache Ant, Xerces, FOP, Gnu xsltproc, ReportLab pyRXP, ImageMagick, JAI, JINI, and XEP. We did all of the editing and processing of the original manuscript on GNU/Linux systems under KDE. The example programs all compile and run under Linux.

The cover photo is of the Panama Canal. Before there was a Panama Canal, ships had to travel down and then up the entire length of South America to get from one coast of the United States to the other. The canal provided a much shorter and more direct path. The aim of this book is to provide a shorter and more direct path for programmers who don't have a lot of extra time and who need to obtain working mastery of C++ OOP and design patterns. Qt 4 makes this possible.

Style Conventions

Monospace--used for any literal symbol that appears in the code listings

Bold--used the first time a term appears (key terms, defined terms, etc.)

Italic--used for emphasis, and also used for wildcards (terms that need to be replaced by "real types" when they are actually used). In monospace text, these terms are set italic and monospace.

"About this title" may belong to another edition of this title.

Top Search Results from the AbeBooks Marketplace

International Edition
International Edition

1.

Ezust, Alan; Ezust, Paul
Published by Prentice Hall
ISBN 10: 0131879057 ISBN 13: 9780131879058
New PAPERBACK Quantity Available: 1
International Edition
Seller
Bookish
(Erlanger, KY, U.S.A.)
Rating
[?]

Book Description Prentice Hall. PAPERBACK. Book Condition: New. 0131879057 International Edition Paperback OR Softcover Edition with Same Contents. Fast Delivery. Book Cover and ISBN may be different from the US Edition. Customer satisfaction guaranteed. Bookseller Inventory # INDSKT-9788131713266

More Information About This Seller | Ask Bookseller a Question

Buy New
US$ 22.30
Convert Currency

Add to Basket

Shipping: US$ 3.99
Within U.S.A.
Destination, Rates & Speeds
International Edition
International Edition

2.

Ezust, Alan; Ezust, Paul
ISBN 10: 0131879057 ISBN 13: 9780131879058
New Paperback Quantity Available: 5
International Edition
Seller
PRIORITY BOOKS
(springfield, VA, U.S.A.)
Rating
[?]

Book Description Paperback. Book Condition: New. Softcover Book, Condition: New. 1st Edition. [Please Read Carefully Before Buying], This Is An International Edition. Printed In Black and White. 656 pages, Book Cover And ISBN No May Be Different From US Edition. Restricted Sales Disclaimer Wordings Not For Sales In USA And Canada May Be Printed On The Cover Of The Book. Standard Shipping 7-14 Business Days. Expedited Shiping 4-8 Business Days. ***WE DO NOT ENTERTAIN BULK ORDERS.*** The Books May Be Ship From Overseas For Inventory Purpose. Bookseller Inventory # 396525

More Information About This Seller | Ask Bookseller a Question

Buy New
US$ 22.37
Convert Currency

Add to Basket

Shipping: US$ 3.99
Within U.S.A.
Destination, Rates & Speeds
International Edition
International Edition

3.

Ezust, Alan; Ezust, Paul
ISBN 10: 0131879057 ISBN 13: 9780131879058
New Paperback Quantity Available: 1
International Edition
Seller
Nick Book House
(fresno, CA, U.S.A.)
Rating
[?]

Book Description Paperback. Book Condition: New. New Softcover International Edition, Printed in Black and White, Only USPS Media mail Shipping ONLY, Different ISBN, Same Content As US edition, Book Cover may be Different, in English Language. Bookseller Inventory # 14591

More Information About This Seller | Ask Bookseller a Question

Buy New
US$ 22.47
Convert Currency

Add to Basket

Shipping: US$ 3.99
Within U.S.A.
Destination, Rates & Speeds

4.

Ezust, Alan; Ezust, Paul
Published by Prentice Hall (2006)
ISBN 10: 0131879057 ISBN 13: 9780131879058
New Paperback Quantity Available: 1
Seller
Irish Booksellers
(Rumford, ME, U.S.A.)
Rating
[?]

Book Description Prentice Hall, 2006. Paperback. Book Condition: New. book. Bookseller Inventory # 0131879057

More Information About This Seller | Ask Bookseller a Question

Buy New
US$ 28.93
Convert Currency

Add to Basket

Shipping: FREE
Within U.S.A.
Destination, Rates & Speeds

5.

Ezust, Alan; Ezust, Paul
Published by Prentice Hall (2006)
ISBN 10: 0131879057 ISBN 13: 9780131879058
New Softcover Quantity Available: 1
Seller
Book Deals
(Lewiston, NY, U.S.A.)
Rating
[?]

Book Description Prentice Hall, 2006. Book Condition: New. Brand New, Unread Copy in Perfect Condition. A+ Customer Service! Summary: Preface xixAcknowledgments xxiiiRationale for the Book xxvAbout the Authors xxviiPART I: Introduction to C++ and Qt 4 2Chapter 1: C++ Introduction 51.1 Overview of C++ 61.2 A Brief History of C++ 61.3 Setup: Open-Source Platforms 71.4 Setup: Win32 121.5 C++ First Example 121.6 Input and Output 161.7 Identifiers, Types, and Literals 191.8 C++ Simple Types 221.9 C++ Standard Library Strings 301.10 Streams 311.11 The Keyword const 341.12 Pointers and Memory Access 361.13 const* and *const 401.14 Reference Variables 43Points of Departure 44Review Questions 45 Chapter 2: Classes 472.1 Structs 482.2 Class Definitions 492.3 Member Access Specifiers 512.4 Encapsulation 542.5 Introduction to UML 542.5.1 UML Relationships 552.6 Friends of a Class 552.7 Constructors 562.8 Subobjects 582.9 Destructors 602.10 The Keyword static 612.11 Copy Constructors and Assignment Operators 642.12 Conversions 672.13 const Member Functions 68Review Questions 79 Chapter 3: Introduction to Qt 813.1 Example Project: Using QApplication and QLabel 823.2 Makefile, qmake, and Project Files 833.3 Getting Help Online 893.4 Style Guidelines and Naming Conventions 903.5 The Qt Core Module 913.6 Streams and Dates 91Points of Departure 93Review Questions 94 Chapter 4: Lists 954.1 Introduction to Containers 964.2 Iterators 974.3 Relationships 99Points of Departure 102Review Questions 103 Chapter 5: Functions 1055.1 Function Declarations 1065.2 Overloading Functions 1075.3 Optional Arguments 1095.4 Operator Overloading 1115.5 Parameter Passing by Value 1165.6 Parameter Passing by Reference 1185.7 References to const 1215.8 Function Return Values 1225.9 Returning References from Functions 1225.10 Overloading on const-ness 1245.11 Inline Functions 1265.12 Inlining versus Macro Expansion 127Review Questions 133 Chapter 6: Inheritance and Polymorphism 1356.1 Simple Derivation 1366.2 Derivation with Polymorphism 1426.3 Derivation from an Abstract Base Class 1486.4 Inheritance Design 1526.5 Overloading, Hiding, and Overriding 1546.6 Constructors, Destructors, and Copy Assignment Operators 1556.7 Processing Command-Line Arguments 158Points of Departure 164Review Questions 165 PART II: Higher-Level Programming 166Chapter 7: Libraries 1697.1 Code Containers 1707.2 Reusing Other Libraries 1717.3 Organizing Libraries: Dependency Management 1737.4 Installing Libraries: A Lab Exercise 1767.5 Frameworks and Components 178Review Questions 180 Chapter 8: Introduction to Design Patterns 1818.1 Iteration and the Visitor Pattern 182Review Questions 190 Chapter 9: QObject 1919.1 QObject's Child Managment 1949.2 Composite Pattern: Parents and Children 1969.3 QApplication and the Event Loop 2009.4 Q_OBJECT and moc: A Checklist 2099.5 Values and Objects 2109.6 tr() and Internationalization 211Point of Departure 211Review Questions 212 Chapter 10: Generics and Containers 21310.1 Generics and Templates 21410.2 Containers 21910.3 Managed Containers, Composites, and Aggregates 22110.4 Implicitly Shared Classes 22410.5 Generics, Algorithms, and Operators 22510.6 Serializer Pattern 22710.7 Sorted Map Example 229Review Questions 235 Chapter 11: Qt GUI Widgets 23711.1 Widget Categories 23911.2 QMainWindow and QSettings 24011.3 Dialogs 24411.4 Images and Resources 24811.5 Layout of Widgets 25111.6 QActions, QMenus, and QMenuBar. Bookseller Inventory # ABE_book_new_0131879057

More Information About This Seller | Ask Bookseller a Question

Buy New
US$ 32.91
Convert Currency

Add to Basket

Shipping: FREE
Within U.S.A.
Destination, Rates & Speeds

6.

Ezust, Alan; Ezust, Paul
Published by Prentice Hall (2006)
ISBN 10: 0131879057 ISBN 13: 9780131879058
New Paperback Quantity Available: 1
Seller
Ergodebooks
(RICHMOND, TX, U.S.A.)
Rating
[?]

Book Description Prentice Hall, 2006. Paperback. Book Condition: New. 1. Bookseller Inventory # DADAX0131879057

More Information About This Seller | Ask Bookseller a Question

Buy New
US$ 28.94
Convert Currency

Add to Basket

Shipping: US$ 3.99
Within U.S.A.
Destination, Rates & Speeds

7.

Ezust, Alan; Ezust, Paul
ISBN 10: 0131879057 ISBN 13: 9780131879058
New Quantity Available: 1
Seller
Castle Rock
(Pittsford, NY, U.S.A.)
Rating
[?]

Book Description Book Condition: Brand New. Book Condition: Brand New. Bookseller Inventory # 97801318790581.0

More Information About This Seller | Ask Bookseller a Question

Buy New
US$ 34.37
Convert Currency

Add to Basket

Shipping: US$ 3.99
Within U.S.A.
Destination, Rates & Speeds

8.

Ezust, Alan; Ezust, Paul
ISBN 10: 0131879057 ISBN 13: 9780131879058
New Quantity Available: 5
Seller
GreatBookPrices
(Columbia, MD, U.S.A.)
Rating
[?]

Book Description Book Condition: New. Bookseller Inventory # 4123677-n

More Information About This Seller | Ask Bookseller a Question

Buy New
US$ 40.39
Convert Currency

Add to Basket

Shipping: US$ 2.64
Within U.S.A.
Destination, Rates & Speeds

9.

Ezust, Alan; Ezust, Paul
Published by Prentice Hall
ISBN 10: 0131879057 ISBN 13: 9780131879058
New Quantity Available: > 20
Seller
INDOO
(Avenel, NJ, U.S.A.)
Rating
[?]

Book Description Prentice Hall. Book Condition: New. Brand New. Bookseller Inventory # 0131879057

More Information About This Seller | Ask Bookseller a Question

Buy New
US$ 42.28
Convert Currency

Add to Basket

Shipping: US$ 3.50
Within U.S.A.
Destination, Rates & Speeds

10.

Ezust, Alan; Ezust, Paul
Published by Prentice Hall (2006)
ISBN 10: 0131879057 ISBN 13: 9780131879058
New Paperback Quantity Available: 3
Seller
Murray Media
(North Miami Beach, FL, U.S.A.)
Rating
[?]

Book Description Prentice Hall, 2006. Paperback. Book Condition: New. Bookseller Inventory # P110131879057

More Information About This Seller | Ask Bookseller a Question

Buy New
US$ 54.78
Convert Currency

Add to Basket

Shipping: US$ 2.99
Within U.S.A.
Destination, Rates & Speeds

There are more copies of this book

View all search results for this book