[Qt-interest] Normalized Signatures and Signaling....
BRM
bm_witness at yahoo.com
Thu Dec 3 15:54:53 CET 2009
I'm working on a class/thread that is basically an inverse of QSignalMapper - taking data from one signal and sending it out to multiple signals for different QThread objects.
I got pretty much everything setup, but am running into a weird issue - and perhaps it's just something I need to understand about Qt or some Qt internals or something...
My object "emits" a signal - I store it as a QByteArray having processed it using QMetaObject::normalizedSignature():
QByteArray theSignal = QMetaObject::normalizedSignature(SIGNAL(mySignal(const QByteArray&)));
I have a function for registering the receiver to the signal:
void myObject::registerReceiver(..., const QObject* _receiver, const char* _method, Qt::ConnectionType _type);
After checking the receiver and method are valid (e.g. non-NULL), I normalize the method:
QByteArray receiverMethod = QMetaObject::normalizedSignature(_method);
And then verify that the two match using QMetaObject::checkConnectArgs().
All this works, and the checks pass. However, also want to verify that the passed method is actually part of the receiver; so I get the receiver's meta object,
and call indexOfMethod(receiverMethod) - which should tell me if the receiver actually has a method by that name (so that I can't do a typo and crash the program).
The problem is that while the signatures match (checkConnectArgs() == true), the receiver object seems to deny that it has the method.
I added some debug output and the receiver's method seems to be a bit odd in the format:
SIGNAL(send(const QByteArray&)) ---> 2send(QByteArray)
where did the '2' come from???
I verified it wasn't a typo on my part; and looking at the MOC file for the receiver's class also didn't reveal anything matching.
Other than the '2' it does pretty well match what is in the MOC file.
Is there something I am doing wrong?
TIA,
Ben
More information about the Qt-interest-old
mailing list