Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.9.7
-
Windows 10 Pro 64 bit Intel
Qt 5.9.7
mingw 5.3.0
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.