[Qt-creator] Q_PROPERY magic goodness
Nicolas Arnaud-Cormos
nicolas.arnaud-cormos at kdab.com
Wed Feb 12 16:40:07 CET 2014
On 12/02/2014 16:26, Jason H 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?
Isn't it what the refactoring option is doing?
Write a Q_PROPERTY line, at the end, press ALt-Enter (or right-click on
the Q_PROPERTY, Refactor->Generate Missing Q_PROPERTY member).
If you want the definition in your source file, you can easily move them
(same way, using the Refactor menu).
Nicolas
>
>
> 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
>
--
Nicolas Arnaud-Cormos | nicolas.arnaud-cormos at kdab.com | Senior Software
Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, www.kdab.fr
KDAB - Qt Experts - Platform-independent software solutions
More information about the Qt-creator
mailing list