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

          For Gerrit Dashboard: QTBUG-99198
          # Subject Branch Project Status CR V

          Activity

            People

              sami.shalayel Sami Shalayel
              agolubev Andrei Golubev
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes