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

Hamish Moffatt hamish at risingsoftware.com
Wed Jul 24 01:49:55 CEST 2019

On 24/7/19 9:45 am, Hamish Moffatt wrote:
> On 24/7/19 12:27 am, 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(). 
> Kind of like Q_COREAPP_STARTUP_FUNCTION that I mentioned?

Sorry, just saw your other post about these being easy to forget (it was 
flagged as spam again).

You originally wrote:

/In order to avoid calling qRegisterMetaType() in main() (with the 
possibility of forgetting to do so,) I instead call it before the 
program enters main(), in the implementation file of whoever is the 
owner of the type. There's several ways to do this, I just use a lambda: /

Isn't that just as easy to forget?

Anyway I guess the question has been answered.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190723/c5fd0bdd/attachment.html>

More information about the Interest mailing list