I have a .h file with such code:
const QEvent::Type MyOnEventType =
QEvent::Type(QEvent::registerEventType( QEvent::User + 500 ) );
This header uses twice in application. I found a problem that in different places MyOnEventType have different integer value. If make a break point on that code above, debugger stops 9 times.
Please help how to declare custom QEvent type ONCE
I'm not 100% sure I'm understanding your question, but it sounds like you need to separate the declaration and the implementation. Something like:
my_event.h
my_event.cpp