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

Properties of dynamic types not resolved correctly in grouped syntax

XMLWordPrintable

      Alias properties aren't being resolved correctly, which can result in property assignment failures and symbol resolution errors.

      The resolution can be forced by evaluating an expression which resolves the alias property, prior to performing an assignment, but this shouldn't be necessary.

      main.qml
      import QtQuick 2.0
      ComplexButton {
          background.color: "#fff000"
      
          Component.onCompleted: {
              console.log("main.qml.onCompleted: " + background.color.toString());
          }
      }
      
      ComplexButton.qml
      import QtQuick 2.0
      Item {
          property alias background: backgroundImg
      
          // No error.
          //Rectangle {
          //    id: backgroundImg
          //    color: "red"
          //}
      
          // Error: main.qml:4:16: Cannot assign to non-existent property "color"
          Image {
              id: backgroundImg
              property color color: "red"
          }
      
          Component.onCompleted: console.log("ComplexButton.qml.onCompleted: " + backgroundImg.color.toString())
      }
      

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

            mvogt Matthew Vogt (closed Nokia identity) (Inactive)
            chriadam Christopher Adams (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes