It would be helpful if clazy could check if a class is able to register itself in Qt's meta-object-system. Sometimes it is a forgotten include (forward declared) or something like this that the moc cannot see the whole class and won't generate the "qRegisterMetaType" itself. Most times the developer will add qRegisterMetaType somewhere because Qt said it at runtime. But clazy could help here to warn if a class is used in signal/slot and moc is not able to generate the registration as it is the better way to let moc do the registration. moc can generate q qt_static_metacall with stuff like this: } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { switch (_id) { default: *reinterpret_cast<int*>(_a[0]) = -1; break; case 0: switch (*reinterpret_cast<int*>(_a[1])) { default: *reinterpret_cast<int*>(_a[0]) = -1; break; case 1: *reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QSharedPointer<CUSTOM_CLASS> >(); break; } break; moc has some more possibilities to detect own types like Q_PROPERTY usage. See: https://code.qt.io/cgit/qt/qtbase.git/tree/src/tools/moc/generator.cpp https://woboq.com/blog/qmetatype-knows-your-types.html
Sounds interesting! Can you attach a sample .cpp file where running moc on it would generate the qRegisterMEtaType ?
Created attachment 112215 [details] Example for QMetaObject::RegisterMethodArgumentMetaType
This allows moc to generate "QMetaObject::RegisterMethodArgumentMetaType" with qRegisterMetaType. If you use a forward-declaration the moc is not enable to recognize it and won't generate qRegisterMetaType. Sadly if you remove "QObject" of DeviceListEntry it is the same problem. Should be available for Q_GADGET, too. That should work but moc needs to be fixed for that. :-(