Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Where the QML modules version information is defined?



  • Hello, I want to understand where the version information in theQML import statement comes from.

    If I do an import with "import QtQuick 2.12"

    On my system it it loads the module from "C:\Qt\Qt5.12.4\5.12.4\android_armv7\qml\QtQuick" but it seems there is just one version and the version information is not visible.

    Where comes the major.minor version from? An which effect has to select another version.

    When I edit the import statement it gives me several proposals for the version. Where this information comes from and what the different versions are telling me?

    0_1566380756084_2019-08-21 QMLmajor_minor_selection.png image url)

    Is there somewhere some more detailed information about the import system and the versioning? I know the following link but it describes not all my questions in detail.

    https://doc.qt.io/qt-5/qtqml-syntax-imports.html

    Thanks Michael


  • Moderators

    @michi said in Where the QML modules version information is defined?:

    Hello, I want to understand where the version information in theQML import statement comes from.

    If I do an import with "import QtQuick 2.12"

    On my system it it loads the module from "C:\Qt\Qt5.12.4\5.12.4\android_armv7\qml\QtQuick" but it seems there is just one version and the version information is not visible.

    Versions are defined in C++ files that form the concrete functionality of each item. These are scattered throughout the code (for example here). So all versions for a single component are defined in same place and they share the same code - they are not in different folders.

    Where comes the major.minor version from? An which effect has to select another version.

    Versioning is bloated and will be removed in Qt 6.

    Anyway, for the most part it works like this: in new versions of Qt, a component might get a new property. Let's say fooProperty was added to Item in Qt 5.13. If you use import QtQuick 2.12 it will only load properties from Qt 5.12, so you will get an error if you try to use fooProperty. But when you import QtQuick 2.13, the property is defined and will work.

    Other than that, the version does not matter - you get same functionality and things will work in the same way. So if you later update to Qt 5.14 but keep import QtQuick 2.13, it won't matter. You will still get all the bug fixes from 5.14.

    When I edit the import statement it gives me several proposals for the version. Where this information comes from and what the different versions are telling me?

    See the documentation. Every component shows you exactly what the import statement for given version is. In most modules, the minor version corresponds to Qt minor release: QtQuick.Controls 2.13 == Qt 5.13.

    Is there somewhere some more detailed information about the import system and the versioning? I know the following link but it describes not all my questions in detail.

    https://doc.qt.io/qt-5/qtqml-syntax-imports.html

    I don't know. My recommendation is to ignore versioning as much as you can. If the code works, don't bother with imports.



  • @sierdzio Thanks a lot for the explanation. Helped me very much for better understanding the topic.


Log in to reply