[Qt-creator] Q_PROPERY magic goodness

Jonathan S. Shapiro shap at eros-os.org
Wed Feb 12 16:36:12 CET 2014


It's an appealing idea, but what happens when a non-trivial getter or
setter is needed?


On Wed, Feb 12, 2014 at 7:26 AM, Jason H <scorp1us at yahoo.com> wrote:

> 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
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20140212/4f332fef/attachment.html>


More information about the Qt-creator mailing list