[Qt-interest] Q_DECLARE_METATYPE, qRegisterType, and threads...

Konrad Rosenbaum konrad at silmor.de
Thu Nov 18 11:32:06 CET 2010


On Wednesday 17 November 2010 22:35:54 BRM wrote:
> QObject::connect: Cannot queue arguemtns for type 'yourEnum' (make sure
> 'yourEnum' is registered using qRegisterType().)
> 
> Problem is, I've declared it several ways that should make it valid to the
> meta-object system:
> 
> yourEnum {
> ...
> };
> Q_DECLARE_METATYPE(yourEnum)
> Q_ENUMS(yourEnum)
> ...
> 
> Note: The above is _not_ in a class definition but a shared header.

Read the error again! ;-)

Place a line like this in the corresponding cpp file:
static int yourEnumMetaId=qRegisterMetaType<yourEnum>();

then you can even use yourEnumMetaId to identify it in a QVariant (type() 
method).


	Konrad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101118/a5d0e8ca/attachment.bin 


More information about the Qt-interest-old mailing list