Chapter 8: QObject, QApplication, Signals, and Slots

QObject is the base class for many of the important classes in the Qt library, such as QEvent, QApplication, QLayout, and QWidget. We refer to any object of a class publicly derived from QObject as a QObject. A QObject can have a parent and children, providing another implementation of the Composite pattern. It can use signals and slots, an implementation of the Observer pattern, to communicate with other QObjects. QObjects make it possible to do event-based programming, which employs QApplication and Qt’s event loop.

Following is an abbreviated look at its definition.

class QObject {  public:    explicit QObject(QObject* parent=0);    QObject * parent () const;    QString objectName() const; ...

Get Introduction to Design Patterns in C++ with Qt, 2nd Edition 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.