×
Namespaces

Variants
Actions

QObject and the Qt Object System

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

Introduction

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
{
Q_OBJECT
//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.
51 page views in the last 30 days.
×