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

qmlRegisterType fails when Name does not match type

    XMLWordPrintable

Details

    • Windows

    Description

      When registering a type in C++ for access in QML the type name must match the string provided to the qmlRegisterType function.  For example:

      qmlRegisterType<TestObj>("TestClasses", 1, 0, "badobject");
      

      This can fail in a couple of ways.  If no other "TestClasses" objects have been successfully registered then it just fails to create the "badobject" type in QML.  If however some other object is already registered in "TestClasses" then a function returning a list of that object will return the object list wrapped in a QVariant.  The attached code illustrates this behavior.  I have wrapped 3 test cases in #defines in main.cpp.  You can enable one at a time to see the problems.

      Attachments

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

        Activity

          People

            ulherman Ulf Hermann
            fcarney Frank Carney
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes