Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.1.0
-
None
Description
When registering an object via qmlRegisterSingletonType, the object can't be passed back to C++ properly.
The attached plugin + qml code shows the behavior, relevant snippets below.
This might be related to QTBUG-30090.
plugin.cpp
... void Test_SingletonPlugin::registerTypes(const char *uri) { // @uri Singleton qmlRegisterSingletonType<SingletonTest>(uri, 1, 0, "SingletonTest", singleton_provider); }
singletontest.cpp
...
void
SingletonTest::testSingleton(QObject *obj)
{
qDebug() << "C++:" << obj;
}
SingletonTest.qml
... console.log(rect) SingletonTest.testSingleton(rect) console.log(SingletonTest) SingletonTest.testSingleton(SingletonTest) ...
Example Output
QQuickRectangle(0x22edaf0) C++: QQuickRectangle(0x22edaf0) SingletonTest(0x22dd330) C++: QObject(0x0)