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

Revisioned properties of parent classes from different modules are inaccessible

    XMLWordPrintable

Details

    • c3999f96536ac359ba94d80755230e85238d578a

    Description

      Assume that class Parent exists in QML module A, and has a revisioned property revProp.
      If class Child in module B derives from Parent, the revisioned property is inaccessible in its instances in QML, no matter which version of B gets imported.

      The reason for this is that when looking for the QML type corresponding to Parent's metaobject in QQmlMetaType::qmlType, we won't accept the the version from module A (as t.availableInVersion(module, version) will only accept the type if it is found in B).

      Using qmlRegisterAnonymousType, the type can be made available in module B, too. However, that method registers the type in revision 0. Consequently,
      QQmlMetaTypeData::propertyCache will not call setAllowedRevision with the correct revision, and revProp is still unavailable.

      Using QML_ANONYMOUS + QML_FOREIGN remedies the issue, but requires some manual work. The correct solution is most likely that qmltyperegistrar checks whether parent exists in the current module, and generates the QML_ANONYMOUS automatically if it is not.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-90521
          # Subject Branch Project Status CR V

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              fabiankosmale Fabian Kosmale
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes