I am attempting something (perhaps stupid).
Have used some macroes to create "amounts" of functions in C++ domain;
#define THR_CONFIG_VALUE(path, value, type, name, defaultvalue) \
type name() { return m_##name; } \
void set##name(type data) { m_##name = data; }
#include <backend/config.i>
#undef THR_CONFIG_VALUE
Based upon following config.i file:
THR_CONFIG_VALUE("", "type", int, ThisType, 0)
THR_CONFIG_VALUE("", "auto", bool, AutoVar1, false)
THR_CONFIG_VALUE("", "auto", bool, AutoVar2, false)
That works fine, i get a number of getter setter functions, also generate member variables the same way (for the record).
Now I start mixing up with QT stuff, trying to use the MOC to generate the Q_PROPERTIES:
#define THR_CONFIG_VALUE(path, value, type, name, defaultvalue) \
Q_PROPERTY(type name READ name WRITE set##name NOTIFY indexChanged)
#include <backend/vessel/thruster/thruster_config.i>
#undef THR_CONFIG_VALUE
The MOC do not care for such attempts. This would have saved me typing 170 Q_PROPERTY lines and in the future several 100's more.
Question 1: Why, preprocessor and MOC sequence? Question 2: Is there a "QT way" ?
Thanks,