Created
November 25, 2013 20:25
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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