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

Aliases to id objects have the wrong type if the object declares properties

    XMLWordPrintable

Details

    • e2397fafc70fd4e5b0a375989bdcf8a402cc41c3

    Description

      The following example declares an alias that points to an id referenced object that declares its own properties (or at least one). That property however is not accessible when trying to access it via a group property declaration, because the type of the alias is Item and not the dynamically created type that includes the restingY property:

      main.qml
      import QtQuick 2.3
      import QtQuick.Window 2.2
      
      Window {
          visible: true
      
          Eye {
              pupil.restingY: 20
          }
      }
      
      Eye.qml
      import QtQuick 2.0
      
      Item {
          property alias pupil: pupil
      
          Item {
              id: pupil
      
              property int restingY
          }
      }
      

      This is due to the engine failing to determine the correct property cache for the pupil group property. We determine it by asking the engine for a property cache for the type of the pupil alias property, which has the meta-type ID for "Item". We would either need to register our own type (and unregister) or, when looking for the type for the alias, follow down to the compilation unit of Eye.qml and fetch the property cache there (which has been enhanced to have the restingY property).

      Attachments

        Issue Links

          Activity

            People

              ulherman Ulf Hermann
              shausman Simon Hausmann
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: