Chapter 15. Meta Objects, Properties, and Reflective Programming

In this chapter we introduce the idea of reflection, the self-examination of an object’s members. Using reflective programming, it becomes possible to write general-purpose operations that work on classes of varied structures. Using QVariant, a generic value-holder, we can operate on built-in types as well as other common types in a uniform way.

15.1

Anti-patterns

342

15.2

QMetaObject: The MetaObject Pattern

344

15.3

Type Identification and qobject_cast

345

15.4

Q_PROPERTY Macro: Describing QObject Properties

347

15.5

QVariant Class: Accessing Properties

350

15.6

DataObject: An Extension of QObject

353

15.7

Property Containers: PropsMap

355

Anti-patterns

Anti-pattern[1] is a term first coined by [Gamma95] ...

Get An Introduction to Design Patterns in C++ with Qt 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.