-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.9
-
None
QML-defined singletons require a qmldir to be "found". If one imports a local directory containing a file marked with the singleton pragma, and attempts to use it, i.e:
main.qml:
import "stuff" Item { Component.onCompleted: console.log(StuffThing.foo) }
stuff/StuffThing.qml:
import QtQuick 2.6 pragma Singleton Item { property int foo }
... will fail with an (unhelpful) ReferenceError: StuffThing is not defined, until one creates a qmldir mentioning the singleton.
I think we should do one or more of the following:
- Remove the qmldir requirement (better compatibility with non-singleton type resolution)
- Document the qmldir requirement more clearly
- See if we can improve the error reporting for this case, so it is clearer that singleton types require resolution here (might be hard).