[Qt-creator] Q_PROPERY magic goodness
Jason H
scorp1us at yahoo.com
Wed Feb 12 16:26:24 CET 2014
Would it be possible to have in addition to the Q_PROPERTY completion template, to add the member, and getter, and setter in the class?
Q_PROPERTY(int emitRate READ emitRate WRITE setEmitRate)
(in private section)
\t#t m_#s;
(in public section)
\t#t #s(); //getter
\t#t set#S(#t #s); //setter
(in cpp file)
#t #c::#s(){ //getter
\treturn m_#s;
}
#t #c::set#S(#t #s){ //setter
\tm_#s = #s;
}
where\t = tab, #s= the property name (emitRate), #S is a cap version (EmitRate), and #c is the class name
It's save me a bunch of time setting up trivial properties!
PS. I used # instead of percent-sign because that tripped a yahoo account hack filter and I had to reset my password and everything. I guess spammers don't test their printfs. LOL
More information about the Qt-creator
mailing list