O'Reilly logo

An Introduction to Design Patterns in C++ with Qt™, Second Edition by Paul Ezust, Alan Ezust

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required