PDA

View Full Version : QObject::connect error with simple typedef types



brcain
19th April 2010, 20:01
I can't get a simple typedef type to work correctly with signals/slots.

Here's the Qt error message:


QObject::connect: Cannot queue arguments of type 'tKey'
(Make sure 'tKey' is registered using qRegisterMetaType().)

BTW, the reason I want to use a typedef is to be able to change the type in the future. I don't want the emitter of the signal to be tied to a specific type.

I tried adding/removing Q_DECLARE_METATYPE(tKey) and qRegisterMetaType<tKey>(), but the problem persists.

I even tried using a #define for tKey, but again the problem persists.


typedef unsigned int tKey;
Q_DECLARE_METATYPE(tKey);
qRegisterMetaType<tKey>()

//...

QObject::connect(&sndr, SIGNAL(foo(tKey)),
&rcvr), SLOT(foo(tKey)));