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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Fixed
    • Affects Version/s: 5.11.0
    • Fix Version/s: 5.11.2
    • Component/s: Core: Object Model
    • Labels:
      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.

        Attachments

        1. testcase.cpp
          0.4 kB
        2. testcase.pro
          0.9 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes