Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.11.0
-
None
Description
A QObject that mixes in a QGadget can't be registered with QML anymore since Qt 5.11:
/opt/Qt/5.11.0/gcc_64/include/QtCore/qmetatype.h: In instantiation of ‘int qRegisterNormalizedMetaType(const QByteArray&, T*, typename QtPrivate::MetaTypeDefinedHelper<T, (QMetaTypeId2<T>::Defined && (! QMetaTypeId2<T>::IsBuiltIn))>::DefinedType) [with T = Model*; typename QtPrivate::MetaTypeDefinedHelper<T, (QMetaTypeId2<T>::Defined && (! QMetaTypeId2<T>::IsBuiltIn))>::DefinedType = QtPrivate::MetaTypeDefinedHelper<Model*, true>::DefinedType]’:
/opt/Qt/5.11.0/gcc_64/include/QtQml/qqml.h:290:65: required from ‘int qmlRegisterType(const char*, int, int, const char*) [with T = Model]’
testcase.cpp:22:49: required from here
/opt/Qt/5.11.0/gcc_64/include/QtCore/qmetatype.h:1724:75: error: ambiguous class template instantiation for ‘struct QtPrivate::MetaObjectForType<Model*, void>’
QtPrivate::MetaObjectForType<T>::value());
...
/opt/Qt/5.11.0/gcc_64/include/QtCore/qmetatype.h:1446:12: error: candidates are: struct QtPrivate::MetaObjectForType<T*, typename std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<T*>::Value>::type>
struct MetaObjectForType<T*, typename std::enable_if<IsPointerToTypeDerivedFromQObject<T*>::Value>::type>
^
/opt/Qt/5.11.0/gcc_64/include/QtCore/qmetatype.h:1456:12: error: struct QtPrivate::MetaObjectForType<T, typename std::enable_if<QtPrivate::IsPointerToGadgetHelper<T>::IsGadgetOrDerivedFrom>::type>
struct MetaObjectForType<T, typename std::enable_if<IsPointerToGadgetHelper<T>::IsGadgetOrDerivedFrom>::type>
^
This used to work with 5.7 and 5.9 at least. See attached minimal test case.