On 22/7/19 10:56 pm, Nikos Chantziaras 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:
namespace {
char unused = [] {
qRegisterMetaType<MyClass::MyEnum>();
return 0;
}();
}
It "seems to work fine," but is this safe though?
Why not put them in a static function in each file, and use
Q_COREAPP_STARTUP_FUNCTION to have Qt call it for you at the right time?
Hamish
_______________________________________________
Interest mailing list
[email protected]
https://lists.qt-project.org/listinfo/interest