Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.0.0 Beta 1
-
None
-
70a2c0491d66aa05f9e9e67f8a845f4df84da857
Description
QML module api's are contextless, (per-engine) singleton types which can be registered just like any other type. Currently, however, to use the type, an import qualifier must be specified, and the functions/properties of the type are accessed through the qualifier. This is inconsistent to the way other types are used.
For example, the current semantics:
import MyComponents 1.0 as C C.BlueRectangle { property int borderWidht: C.BlueRectangle.BorderWidth // enum property int random: C.getRandom() // module api func }
is confusing, since there is no way to tell what in C is providing the "getRandom()" function; furthermore, only one type in C could be providing it (or resolution conflicts would occur). It would be more consistent if it were:
import MyComponents 1.0 as C C.BlueRectangle { property int borderWidht: C.BlueRectangle.BorderWidth // enum property int random: C.PRNG.getRandom() // module api func }
The semantics of qualified module API imports should be fixed.
Also, the name of the moduleApi type should be changed, since it really is just a singleton type.