Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-68803

[REG 5.9 -> 5.11.0] Can't register QObject that mixes in QGadget with QML anymore

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P1: Critical P1: Critical
    • 5.11.2
    • 5.11.0
    • Core: Object Model
    • None

      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.

        1. testcase.cpp
          0.4 kB
          Mathias Hasselmann
        2. testcase.pro
          0.9 kB
          Mathias Hasselmann
        For Gerrit Dashboard: QTBUG-68803
        # Subject Branch Project Status CR V

            dvratil Daniel Vrátil
            hasselmm Mathias Hasselmann
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes