[Interest] Is it safe to call qRegisterMetaType() before main()?

Thiago Macieira thiago.macieira at intel.com
Tue Jul 30 02:52:59 CEST 2019


On Monday, 29 July 2019 13:28:04 PDT Nikos Chantziaras wrote:
> > This is only required when referring to it by name, such as in old-style
> > signal-slot connection, QML, D-Bus, etc.
> 
> They're new-style connections, but are sometimes of QueuedConnection
> type since some connections are used for inter-thread communication. If
> I don't use Q_ENUM or Q_REGISTER_METATYPE (and thus also don't call
> qRegisterMetatype(),) the connections won't work and you get this at
> runtime:
> 
>    QObject::connect: Cannot queue arguments of type 'MyClass::MyEnum'

The queuing is actually "old style" since it goes back to the meta object 
string format to get the parameter types.

Olivier, didn't you have at some point a patch that made the meta object 
register all parameters as metatypes on request? That would solve Nikos's 
problem.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel System Software Products






More information about the Interest mailing list