PDA

View Full Version : signal from QMetaMethod



magland
14th June 2007, 08:13
I need to connect a signal retrieved from QMetaMethod::signature(). There doesn't seem to be a Qt function to achieve this, so I had a look at the SIGNAL macro, and so this is what I do (basically stick a "2" in front of the signature):



QMetaMethod mymethod=...;
char holdstr[1000];
sprintf(holdstr,"2%s",mymethod.signature());
connect(obj,holdstr,this,SLOT(myslot()));


It's a hack and I don't like it -- not even sure it will work all the time. Is there a better way to achieve this?

Thanks

wysota
14th June 2007, 09:07
It's fine, though using sprintf in no the best way to get that string :) You could manipulate the meta object directly but the result would be the same, so it's not worth it.