Caius Aérobus
30th April 2009, 12:54
Hello,
I would like to use a macro in the slot section but the moc preprocessor encapsulates it BEFORE the C++ preprocessor processes it, which leads to an error. How to cope with this issue?
Macro function:
#define SetFloatSlotMacro(name, arg) \
void Set##name(QString arg) {this->Set##name(arg.toFloat());}; \
void Set##name(float arg)
Resulting code in moc generated file:
case 4: { int _r = SetFloatSlotMacro((*reinterpret_cast< IdleToWalk(*)>(_a[1])),(*reinterpret_cast< speed(*)>(_a[2])));
if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break;
Error at compile time:
moc_Avatar.cpp:94:1: error: pasting "Set" and "(" does not give a valid preprocessing token
I would like to use a macro in the slot section but the moc preprocessor encapsulates it BEFORE the C++ preprocessor processes it, which leads to an error. How to cope with this issue?
Macro function:
#define SetFloatSlotMacro(name, arg) \
void Set##name(QString arg) {this->Set##name(arg.toFloat());}; \
void Set##name(float arg)
Resulting code in moc generated file:
case 4: { int _r = SetFloatSlotMacro((*reinterpret_cast< IdleToWalk(*)>(_a[1])),(*reinterpret_cast< speed(*)>(_a[2])));
if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break;
Error at compile time:
moc_Avatar.cpp:94:1: error: pasting "Set" and "(" does not give a valid preprocessing token