Skip to Content
Programming with Qt, 2nd Edition
book

Programming with Qt, 2nd Edition

by Matthias Kalle Dalheimer
January 2002
Beginner to intermediate
522 pages
14h 36m
English
O'Reilly Media, Inc.
Content preview from Programming with Qt, 2nd Edition

Chapter 8. Container Classes

Container classes were one of the first types of classes that were put into class libraries. Container classes are used for objects that contain other objects, such as arrays or lists. Most GUI class libraries have included container classes.

Note that if you have experience in other programming languages that are commonly used for GUI programming, such as Java, you might understand the notion of “container” differently. In the Java AWT, containers are objects that can hold other GUI objects. In Qt, there is no such difference; every GUI object can hold other GUI objects, even though it does not always make sense. For example, having a button contain other GUI objects would be of no use. Qt uses the classic C++ notion of container classes that can hold other objects in the sense of memory references, not in the more specific sense of general containment.

With the advent of the C++ standard, another library with container classes, the Standard Template Library (STL), has been included in the standard. This standard will lead to all compiler vendors including it.

Nevertheless, it still pays to learn how to use Qt’s own container classes. STL is not easy to learn, and when all you want to do is put some strings in a list and iterate over it, you can just as well use the Qt classes. Of course, these classes are not as sophisticated as the STL classes, and there aren’t quite as many of them. However, if Qt contains what you need, I would suggest giving ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C++ GUI Programming with Qt 4

C++ GUI Programming with Qt 4

Jasmin Blanchette, Mark Summerfield
C++ GUI Programming with Qt 4

C++ GUI Programming with Qt 4

Jasmin Blanchette, Mark Summerfield

Publisher Resources

ISBN: 0596000642Supplemental ContentErrata Page