Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Qt Q_PROPERTY macro that includes member variable, getter, setter and changed signal
#define Q_PROPERTY_FULL(member, _type) \
Q_PROPERTY(_type member READ member WRITE set##member NOTIFY member##Changed) \
public: \
void set##member##(_type _arg_##member) { if (m_##member != _arg_##member) {m_##member = _arg_##member; Q_EMIT member##Changed(); } } \
_type member##() const { return m_##member; } \
Q_SIGNALS: \
void member##Changed(void); \
private: \
_type m_##member;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment