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

qmllint does not know the type of "this"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Not Evaluated Not Evaluated
    • 6.8.1
    • 6.8.0
    • QML: Tooling
    • None

      qmllint does not know the type of "this", interpreting every "this" as being of type "QObject", however id references to the same object work. "Item" can be replaced with any other type.

      import QtQuick
      
      Item {
          id: object
          property string test: "test";
          function testfn() {
              console.log(this.test)
              console.log(object.test)
          }
      }
      

      produces

      $ qmllint test/qmllsthis.qml -I [...]
      Warning: test/qmllsthis.qml:9:20: Member "test" not found on type "QObject" [missing-property]
              console.log(this.test)
                               ^^^^
      

      qmlls reports the same.

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

            qtqmlteam Qt Qml Team User
            jirauser69088 user-b4e76 (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes