QObject and the Qt Object System
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:
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.