[Development] qmlbundle vs Qt Resource System

Simon Hausmann simon.hausmann at digia.com
Fri Aug 16 13:02:32 CEST 2013


On Tuesday 13. August 2013 12.40.20 Thomas Hartmann wrote:
[...]
> Another topic that came up was qmldir. Since Qt 5 now supports to .json
> to describe and annotate a plugin, shouldn't we use this instead of
> another arbitrary file format? Of course we will continue support for
> qmldir, but we should depreciate it and use .json instead. Like for any
> other plugin in Qt.
> 
> The qmldir file could be replaced by qmldir.json in the pure .qml plugin
> case.
> 
> If the plugin is converted to .rcc the .rcc file contains the
> qmldir.json file.

I'm not sure that buys us a lot TBH.

AFAICS we have three types of qml modules:

1) A QML module that consists only of QML files (and maybe image assets and 
other stuff). So in that case qmldir.json would work as a replacement for 
qmldir.

2) A QML module written entirely in C++. With the current code there's still a 
qmldir file, next to the plugin shared library. Your suggestion is to embed the 
qmldir as json plugin data into the .so, right?

3) A QML module written as a hybrid. This is current QtQuick Controls for 
example and the qmldir describes the .qml files as well as the name of the 
plugin to load. Theoretically the qmldir could be embedded as JSON data into 
the plugin. However it is possible (and supported) that a qmldir contains 
multiple plugin lines - the module can consists of multiple plugins. In that 
case we can't embed the JSON data and have to keep a separate qmldir.json file.


So then I wonder: What did we win? What problem did we solve?

Only in case 2 we can embed the JSON data, and the code for resolving imports 
becomes more complex that it currently is. (not looking for qmldir only, now 
we need to look for qmldir.json first, then look for a *.[native dso extension] 
and then fall back to qmldir)


Simon



More information about the Development mailing list