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

qmllint does not allow 'print' as invokable method name

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • 6.5.4, 6.5, 6.6.1, 6.7.0 FF
    • 6.6.0 Beta3
    • QML: Tooling
    • None
    • 42daf5874 (dev), 0a8390881 (6.6), e6ec87d35 (6.5)

    Description

      Does qmllint handle the "print" identifier somehow special?

      import QtQuick
      import QtQuick.Window
      
      import untitled5
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          Foo {
              id: foo
          }
      
          Component.onCompleted: {
              foo.print(); // <<< qmllint "Member print not found"
              foo.bar(); // <<< this is ok
          }
      }
      
      #ifndef FOO_H
      #define FOO_H
      
      #include <QObject>
      #include <QQmlEngine>
      
      class Foo : public QObject
      {
        Q_OBJECT
        QML_ELEMENT
      public:
        explicit Foo(QObject *parent = nullptr);
      
        Q_INVOKABLE void print() {} // <<< qmllint complains
        Q_INVOKABLE void bar() {}
      };
      
      #endif // FOO_H
      
      Warning: .../untitled5/Main.qml:17:13: Member "print" not found on type "Foo" [missing-property]
              foo.print();
                  ^^^^^
      Info: Did you mean "print"?
              foo.print();
                  ^^^^^
      

      Attachments

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

        Activity

          People

            olivier.decanniere Olivier De Cannière
            njeisecke_qtc Nils Jeisecke
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes