Last active
January 22, 2020 11:12
-
-
Save TheZoc/eb17938509c5e4ec1c9c31a9674122a8 to your computer and use it in GitHub Desktop.
Q_PROPERTY with functions (Qt Creator Snippet)
This file contains hidden or 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
Q_PROPERTY($type$ $name$ READ $name:c$ WRITE Set$name:c$ NOTIFY $name$Changed) | |
$type$ $private_variable$_; | |
$type$ $name:c$() const { return $private_variable$_; } | |
void Set$name:c$(const $type$& $private_variable$) | |
{ | |
if ($private_variable$_ == $private_variable$) | |
return; | |
$private_variable$_ = $private_variable$; | |
emit $name$Changed(); | |
} | |
void $name$Changed(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment