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

QVariant::setValue() asserts when passing an object of qmltc-generated type wrapped in QT_NAMESPACE

    XMLWordPrintable

    Details

      Description

      I see the following output by QVariant::setValue() and functions alike:

          // QT_NAMESPACE=TestNamespace
          TestNamespace::HelloWorld *obj = new TestNamespace::HelloWorld(&e, parent);
          QVariant var; // or " = QVariant::fromValue(obj)"
          var.setValue(obj); // asserts here
          QVERIFY(var.isValid());
      

      In this particular case, the assertion is:

      ASSERT failure in qRegisterNormalizedMetaType: "qRegisterNormalizedMetaType was called with a not normalized type name, please call qRegisterMetaType instead.", file /home/ag/work/build/qt5_namespaced/qtbase/include/QtCore/../../../../../qt5/qtbase/src/corelib/kernel/qmetatype.h, line 1235

      This is due to normalizedTypeName passed to qRegisterNormalizedMetaType() (in QMetaTypeIdQObject<T*, QMetaType::PointerToQObject>::qt_metatype_id()) being unequal to what QMetaObject::normalizedType(normalizedTypeName.constData()).
      This happens due to QMetaObject::normalizedType() skipping Qt namespace when it's specified, while normalizedTypeName still uses the Qt namespace.

        Attachments

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              qtqmlteam Qt Qml Team User
              Reporter:
              agolubev Andrei Golubev
              PM Owner:
              Vladimir Minenko Vladimir Minenko
              RnD Owner:
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes