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

Add lint rule for alias properties with custom properties on unnamed types

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • 6.11
    • 6.9.0
    • QML: Tooling
    • None
    • All

      Add a qmllint rule to detect when alias properties point to objects with custom properties that can't be accessed via grouped property syntax. See original discussion: https://bugreports.qt.io/browse/QTBUG-66632

      Current warning: Cannot assign to non-existent property "restingY"

      // Eye.qml
      Item {
          property alias pupil: pupil
          
          Item {
              id: pupil
              property int restingY  // Custom property on unnamed type
          }
      }
      
      // main.qml  
      Eye {
          pupil.restingY: 20  // This should trigger lint warning
      }
      
      

      Now this is confusing because the property is right there.

      Possible message:

      Warning: Property 'restingY' on alias 'pupil' is not accessible via grouped syntax. The alias has type 'Item' but the target object defines additional properties. Consider creating a proper type using an inline component or separate .qml file.

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

            qtqmlteam Qt Qml Team User
            kelteseth Elias Steurer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes