Skip to content

Instantly share code, notes, and snippets.

@jesperhh
Created November 25, 2013 20:25
Show Gist options
  • Save jesperhh/7648254 to your computer and use it in GitHub Desktop.
Save jesperhh/7648254 to your computer and use it in GitHub Desktop.
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