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

Revisioned properties of parent classes from different modules are inaccessible

    XMLWordPrintable

    Details

      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

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

            Activity

              People

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

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes