[Interest] qmldir Internal Singleton File

Richard Weickelt richard at weickelt.de
Fri May 3 23:40:43 CEST 2019


Furkan,

> In the documentation for qmldir, there’s an option to make a QML document
> internal to the module it’s defined in with the /internal/ keyword. But when
> I use it like so
> 
> /Internal singleton MySingleton.qml 1.0 MySingleton.qml/
> /
> /
> I get the following error:
> 
>> /invalid qmldir directive contains too many tokens./
> /
> /
> Is this not supported or am I using it wrong?

The parser is implemented in
https://code.qt.io/cgit/qt/qtdeclarative.git/tree/src/qml/qmldirparser/qqmldirparser.cpp?h=dev


I would say that this is not possible at the moment. You can try to add this
to the parser, it should be very simple. If you are lucky, the resolveType()
functions in qqmlimport.cpp already handle internal composite singletons
correctly. I have taken a look at it and am quite optimistic that this is
the case. If not, you will have to fight your way through these functions in
qqmlimport.cpp.

Note that the "internal" keyword belongs into directory listing qmldir files
(those without version numbers), while the singleton keyword is only
documented for module qmldir files (those with version numbers). However,
singleton works in both variants, which is not documented. Maybe worth a bug
report as well.

This is not a qualified answer ;-)

Best regards
Richard



More information about the Interest mailing list