[Interest] Is it safe to call qRegisterMetaType() before main()?
Thiago Macieira
thiago.macieira at intel.com
Sun Jul 28 06:15:51 CEST 2019
On Friday, 26 July 2019 17:35:03 PDT Nikos Chantziaras wrote:
> I didn't (although I use Q_ENUM, but it does the same job.) But there's
> no constructor to put qRegisterMetaType() in. It's an enum. There's no
> constructor. Some enums are in a namespace, some are in a class, but
> even with an enum that is in a class, users of can just use the enum in
> their own signals/slots prior to instantiating the class that declares
> the enum. It will stay unregistered until the first instance of the
> class is created.
> ____________________
I meant in the class it's most likely to be used in.
This is only required when referring to it by name, such as in old-style
signal-slot connection, QML, D-Bus, etc.
Loading it into a QVariant automatically registers, as QVariant calls
qMetaTypeId<Enum>() to get the metatype ID.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel System Software Products
More information about the Interest
mailing list