Option 2 suggested above works best I think and is the cleanest solution. To sum it up:

Header file for event definition:

#ifndef EVENTDEFINITIONS_H #define EVENTDEFINITIONS_H #include <QEvent> extern const QEvent::Type TYPE_AUDIO; #endif // EVENTDEFINITIONS_H

Cpp file for the event definitions where it is initialized:

#include <eventdefinitions.h> const QEvent::Type TYPE_AUDIO = static_cast<QEvent::Type>(QEvent::registerEventType());

Event subclass:

#ifndef AUDIOEVENT_H #define AUDIOEVENT_H #include <eventdefinitions.h> #include <QDebug> class AudioEvent : public QEvent { public: explicit AudioEvent(); }; #endif // AUDIOEVENT_H #include "audioevent.h" AudioEvent::AudioEvent() : QEvent(TYPE_AUDIO) { qDebug()<<QString("Creating custom event(%1)").arg(static_cast<int>(type())); }