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

Misleading qmllint warning

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • 6.11
    • 6.10
    • QML: Tooling
    • None

      When referring to parent in AnchorsChanges, it's unwise to suggest the AnchorChange's parent as the place to resolve to. 

      Consider

       

      import QtQuick
      Item {
          id: root
          Item {
             parent: root.parent
             id: slidersColumn
             anchors.left: parent.right
          }
          AnchorChanges {
              target: slidersColumn
              anchors.left: undefined
              anchors.horizontalCenter: parent.horizontalCenter
          }
      }
      

      which yields 

      Warning: test.qml:15:35: Unqualified access [unqualified] 
             anchors.horizontalCenter: parent.horizontalCenter 
                                       ^^^^^^ 
      Info: parent is a member of a parent element. 
           You can qualify the access with its id to avoid this warning. 
      
             anchors.horizontalCenter: root.parent.horizontalCenter

      But parent would be resolved in the context of the AnchorChange's target, so the proposed change is wrong

       

       

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

            dheerendra Dheerendra Purohit
            fabiankosmale Fabian Kosmale
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes