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

BRM bm_witness at yahoo.com
Thu Nov 18 15:34:44 CET 2010


----- Original Message ----

> From: Konrad Rosenbaum <konrad at silmor.de>
> 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).
> 

Okay - stupid me.

Yes - I read the error message; however, I thought I had it registered already 
in a number of other threads that I have.
Upon further review, I discovered found that I only did so in some private 
threads in a couple other programs.
Comparatively, I have a number of other things that I do register in most 
everything - so it was a fair assumption I did this one too.
That was why I had the original - I thought it was already being registered some 
where else and was not in this thread for some reason.

Apologies - grep'ing code for verification

Ben



More information about the Qt-interest-old mailing list