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

Misleading qmllint warning

    XMLWordPrintable

Details

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

    Description

      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

       

       

      Attachments

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

        Activity

          People

            qtqmlteam Qt Qml Team User
            fabiankosmale Fabian Kosmale
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes