Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-93780

QML type versioning mechanism needs better documentation

XMLWordPrintable

      In Qt5, you could mix and match QML module versions with metaobject revisions, via manual calls to qmlRegister*.

      In Qt6, with the type registration macros, you cannot do this anymore. The versions declared with the macros hold for any module the type is exposed to. So, if your module exports a version 1.x, and one of your types inherits QQuickItem, then you cannot use the properties added to QQuickItem in the 2.x series of QtQuick.

      This effect is exposed in qtdeclarative/examples/qml/tutorials/chapter3-bindings in our examples.

      The recommended fix is to:

      1. bump the module version to match the base classes' maximum versions
      2. Drop all versions from import statements

      Versions in import statements are not needed when you stick to qualified access. Therefore, versions can generally become an internal affair of QML modules.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            ulherman Ulf Hermann
            ulherman Ulf Hermann
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes