All-inclusive Q_PROPERTY macro
When declaring properties in Qt, the Q_PROPERTY macro is used to define the property. However, this is only to make the Qt Meta-Object System aware of the property, you still have to manually define at least a getter, and optionally a setter, a member variable and a signal to notify when changed (and possible a reset function). To avoid this, I combined all this functionality in one macro (Gist) (except the reset function, feel free to add this yourself).
One thing to note is the use of Q_SIGNALS
AND Q_EMIT
instead of signals
and emit
, as I had some issues getting the MOC compiler to accept the macro when using the keywords.