Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
6.10.0 FF
-
None
Description
In QML you can have anonymous types. Those are types the QML engine can deal with when passed from a property implemented in C++ but which do not have names in QML. You cannot declare a property of such a type in QML, nor can you use such a type in a type annotation on a function.
Most prominently several number types are anonymous so far: quint64, qint64, float, etc
qdoc has worked around the issue by accepting C++ names in QML documentation for quint64 and qint64 (and possibly more types). This can be seen in the documentation for the RenderStats type in QtQuick3D, among others.
This technique, however, is:
- somewhat misleading since it makes people believe that "qint64" is a name they can use in QML, which it isn't.
- necessarily incomplete. There probably is some fixed list of types somewhere in qdoc for this, but we can have as many anonymous types as we like.
The solution could be multifaceted.
- We should probably give names to most anonymous types (and document them). We want people to use type annotations and anonymous types can't be used in type-annotated functions. This makes life unnecessarily hard for users.
- We should provide some syntax to document an anonymous type by using its C++ name. qdoc would then generate something along the lines of "anonymous QML type backed by Foo". The QML_ANONYMOUS macro is public API after all, and users can have their own anonymous types. qdoc should be able to deal with them.