[Interest] Queued signals lost in 5.15.0 (works in 5.12.5) (Windows)

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Sat Sep 26 17:52:46 CEST 2020


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.dangelo at 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4329 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200926/da7209c0/attachment.bin>


More information about the Interest mailing list