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

Nikos Chantziaras realnc at gmail.com
Wed Jul 24 18:05:02 CEST 2019


On 24/07/2019 17:23, Thiago Macieira wrote:
> On Tuesday, 23 July 2019 07:27:27 PDT Nikos Chantziaras wrote:
>> Ugh. Having the call happen on every object creation sounds even uglier.
>> It seems it's best to roll our own. Probably a lazily initialized global
>> static object that you can add functors to before main() and then run
>> all functors of that object in main().
> 
> Use qMetaTypeId<Type>(). That will include an inline check (runtime, sure)
> whether it's already been registered.

That is a good solution for instantiable types, but for enums (my actual 
use case) you can't do that.



More information about the Interest mailing list