[Qt-creator] Q_PROPERY magic goodness

Jason H scorp1us at yahoo.com
Wed Feb 12 18:15:34 CET 2014


You replace the one it gave you. It's pretty trivial. Odds are you'll only add to what it gives you, IMHO.



________________________________
 From: Jonathan S. Shapiro <shap at eros-os.org>
To: Jason H <scorp1us at yahoo.com> 
Cc: Qt Creator mailing list <qt-creator at qt-project.org> 
Sent: Wednesday, February 12, 2014 10:36 AM
Subject: Re: [Qt-creator] Q_PROPERY magic goodness
 


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/6430e660/attachment-0001.html 


More information about the Qt-creator mailing list