I am using the Q_PROPERTY macro as described here:
http://doc.qt.nokia.com/4.7-snapshot/properties.html
Let's consider this macro declaration:
Q_PROPERTY(int foo READ getFoo WRITE setFoo)
Now I am required to define a function getFoo() and setFoo(int):
int getFoo() { return foo; }
void setFoo(int x) { foo = x; }
Is there a way to automatically generate these two functions? The reason I ask is I would like to define 20-30 Q_PROPERTY macros for each of the parameters that control a simulation system I coded up, and I never need to define a read or write function that's more complicated than the ones above.
My only option right now is to write a Perl script to perform this code generation, but I was hoping there was an elegant way using Qt to specify "default functions" of this kind.
Thanks.
Bookmarks