On 26/09/2020 16:53, Alexander Dyagilev wrote:
I use this helper macro for this (register a metatype in runtime):template <class T> inline void qRegisterMyMetaType(const char *name) { if (QMetaType::type(name) == QMetaType::UnknownType) qRegisterMetaType<T>(name); } #define Q_REGISTER_MY_METATYPE(type) qRegisterMyMetaType<type>(#type); Usage example: Q_REGISTER_MY_METATYPE(QCryptographicHash::Algorithm);
This machinery is not strictly needed -- it's perfectly fine to call qRegisterMetatype<T> multiple times (you could for instance put it in the constructor of T itself). The point is that you have to call it before emitting (in case of a queued activation on an autoconnection) or even before connecting (in case you're forcing a queued connection).
Either way, if you forget, Qt should emit a warning telling you exactly what to do.
HTH, -- Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer KDAB (France) S.A.S., a KDAB Group company Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com KDAB - The Qt, C++ and OpenGL Experts
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest