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

qmllint: False positive for required property

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • 6.8
    • 6.7.2
    • QML: Compiler
    • None
    • All

    Description

      Additionally to the code in the description I also attached the project: RequiredLintTest.zip

      This looks like a false positive for me because Usage.qml already set the required property. But additionally there is a property alias to be able to optionally change the value from outside. This leads to a wrong requirement in Main.qml.

      Output from qmllint:

      [RequiredLintTest]$ ~/Dokumente/toolchain-linux/dist/bin/qmllint Main.qml
      Warning: Main.qml:9:2: Component is missing required property propTest from Usage [required]
      	Usage {
      	^^^^^
      

      Base.qml:

      import QtQuick
      
      Item {
      	required property int myProp
      }
      

      Usage.qml:

      import QtQuick
      
      Item {
      	property alias propTest: subItem.myProp
      
      	Base {
      		id: subItem
      
      		myProp: 42
      	}
      }
      

      Main.qml:

      import QtQuick
      
      Window {
      	height: 480
      	title: qsTr("Hello World")
      	visible: true
      	width: 640
      
      	Usage {
      	}
      }
      

      Attachments

        For Gerrit Dashboard: QTBUG-127098
        # Subject Branch Project Status CR V

        Activity

          People

            olivier.decanniere Olivier De Cannière
            larss Lars Schmertmann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There is 1 open Gerrit change