Details
-
Bug
-
Resolution: Incomplete
-
P3: Somewhat important
-
None
-
5.3.1
-
None
-
Windows 7, Qt 5.3.1
Description
I have 2 thread each runnning their own QQmlEngine (the threads are not really important here, 2 QQmlEngine are). Instanciating their own Singleton from C++ with qmlRegisterSingletonType<T>() exposition with the callback with QQmlEngine *qml_engine make it possible to have a singleton instance per different engine. In Qml script (.qml) and qmldir singleton, the singleton get the same instance but the QQmlEngine complain that the singleton instance does not belong to the proper QQmlEngine.
Even the qmlRegisterSingletonType with QUrl does not have a callback to give the proper instance per engine. Seem like only the first QQmlEngine that used a singleton can used it from that point on.
If a singleton instance must belong to QQmlEngine to be usable, why not create one per QQmlEngine by default. Or at least make it possible to create one per QQmlEngine that request it.
This observed into Qt 5.3.1, but since the API haven't changed I suspect it would still be there in 5.5.x.