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

QMLLINT: warnings about missing imports with directory imports

    XMLWordPrintable

Details

    • 6d15a35e9c (qt/qtdeclarative/dev) 6d15a35e9c (qt/tqtc-qtdeclarative/dev)

    Description

      Qml files within a module seem to trigger warnings about missing imports in QMLLINT when the files contain directory imports

      Example:

      import QtQuick
      
      import "../Directory2" as Directory2
      
      Item {
          id: root
      
          Rectangle {
              anchors.fill: parent
              color: "green"
          }
      
          Directory2.D2 {
              x: 0
              y: 0
              width: 10
              height: 10
          }
      }
      

      triggers a number of warnings:

      Warning: C:/dir/QmlLintWarning/Module/Directory1/D1.qml:13:5: Directory2.D2 was not found. Did you add all import paths?
          Directory2.D2 {
          ^^^^^^^^^^
      Warning: C:/dir/QmlLintWarning/Module/Directory1/D1.qml:14:9: Binding assigned to "x", but no property "x" exists in the current element.
              x: 0
              ^
      Warning: C:/dir/QmlLintWarning/Module/Directory1/D1.qml:15:9: Binding assigned to "y", but no property "y" exists in the current element.
              y: 0
              ^
      Warning: C:/dir/QmlLintWarning/Module/Directory1/D1.qml:16:9: Binding assigned to "width", but no property "width" exists in the current element.
              width: 10
              ^^^^^
      Warning: C:/dir/QmlLintWarning/Module/Directory1/D1.qml:17:9: Binding assigned to "height", but no property "height" exists in the current element.
              height: 10
              ^^^^^^
      

      Which all seem to disappear when switching the import statement path to:

      :/qml/Module/Directory2
      

      but this doesn't work in practice => results in an error during runtime.

      Steps to reproduce the problem:

      • Build the attached project with _qmllint target
      • If qmllint target removed, app builds & runs fine

      NOTE: qmlsc seems to produce very similar errors.

      Attachments

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

        Activity

          People

            max.goldstein Maximilian Goldstein
            miikapernu Miika Pernu
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes