On Saturday, 26 September 2020 07:53:23 PDT Alexander Dyagilev wrote:
> template <class T>
> inline void qRegisterMyMetaType(const char *name)
> {
>      if (QMetaType::type(name) == QMetaType::UnknownType)
>          qRegisterMetaType<T>(name);
> }

Better implementation:

template <class T>
inline void qRegisterMyMetaType(const char *name)
{
    Q_UNUSED(name);
    qRegisterMetaType<T>();
}

#define Q_REGISTER_MY_METATYPE Q_DECLARE_METATYPE

This checks that whether the type is already registered without making a 
function call.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering



_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to