[Development] Determining what versions of imports a QML module provides

Ulf Hermann ulf.hermann at qt.io
Tue Feb 25 09:35:51 CET 2020


> That was my first thought (before looking at the qmldir files) as well, but it doesn't seem to help with the same modules that are problematic with the qmldir scanner.
> e.g. QtQuick.tooling:

QtQuick.tooling does not exist. It's only there to have an import 
statement in the *.qmltypes files.

> I also don't see the version number for the QtQuick import - e.g.
> $ find /usr/lib64/qt5/qml/QtQuick* -name plugins.qmltypes |xargs grep '2\.15'
> only shows some submodules.

Each type has a list of exports that tells you the version at which each 
of its metaobject revisions was introduced. For example:

     Component {
         name: "QQuickAnimatedSprite"
         defaultProperty: "data"
         prototype: "QQuickItem"
         exports: [
             "QtQuick/AnimatedSprite 2.0",
             "QtQuick/AnimatedSprite 2.1",
             "QtQuick/AnimatedSprite 2.11",
             "QtQuick/AnimatedSprite 2.12",
             "QtQuick/AnimatedSprite 2.15",
             "QtQuick/AnimatedSprite 2.4",
             "QtQuick/AnimatedSprite 2.7"
         ]
         exportMetaObjectRevisions: [0, 1, 11, 12, 15, 4, 7]
	[...]
     }

There is no global version for any specific import. For example, we may 
not change anything between version 7.20 and 7.21 of some module FooBar. 
Once we release the corresponding Qt version, you can still do "import 
FooBar 7.21". It will have the same effect as "import FooBar 7.20". The 
maximum version mentioned in the FooBar's plugins.qmltypes file will 
then be 7.20.

Ulf


More information about the Development mailing list