QObject and the Qt Object System

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): Emulator
Platform(s): S60 3rd Edition, S60 5th Edition
Platform Security
Signing Required: Self-Signed
Capabilities: None
Keywords: Q_OBJECT
Created: kamaljaiswal (29 Dec 2008)
Last edited: hamishwillee (11 Oct 2012)


QObject forms the heart of Qt's object system. It is the base class for any object that uses the meta-object system (like signals and slots). QObject based classes are declared as below:

#include <QObject>
class Counter: public QObject
//some code here

Note the use of the Q_OBJECT macro. This must be declared at the beginning of the class definition. Forgetting Q_OBJECT is a common error among beginners. The class will not compile, and the compiler shows some errors about some methods missing in the table.

See also

This page was last modified on 11 October 2012, at 04:18.
43 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.