I'm developing qt application and we know that qt's SLOT
and SIGNAL
can convert input as char *
which is needed by connect
function. But my signals are coded as macros:
//NOTE following line is NOT RIGHT way, but just my idea
#define TEST_SIGNAL(name) #name##Changed##(##)
If I call this macro somewhere as:
// given defined integer variable
// int testInt;
TEST_SIGNAL(testInt)
which should generate following string:
"testIntChanged()"
So I can call that macro definition within connect
:
// here we can focus on only second parameter of connect, eg. TEST_SIGNAL(testInt)
// given other parameters
connect(this, TEST_SIGNAL(testInt), this, SLOT(testIntHandle()));
Is it possible with macros #
and ##
in c++? If not, which is the better way?
Thanks.
Aucun commentaire:
Enregistrer un commentaire