As explained in the comments, you have to add the Q_OBJECT
macro in the class declaration. Many doc on the internet will help you to understand why this is necessary:
- When should Q_OBJECT be used?
- http://doc.qt.io/qt-5/qobject.html#Q_OBJECT
- http://doc.qt.io/qt-5/metaobjects.html