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

qmllint: Cannot 'qualify' access to private types like KeyEvent, MouseEvent.

    XMLWordPrintable

Details

    Description

      It's currently not possible to make qmllint happy with statements like this (without qmllint disable):

          Keys.onEscapePressed: (event) => { 
              event.accepted = true;
          }
      

      This is due to multiple issues when trying to compile the project:
      1. It's not possible to annotate these types of functions. 'Keys.onEscapePressed: (event: KeyEvent) =>' results in this error:

      error: Expected token `,'
      

      2. Changing to Keys.onEscapePressed: function(event: KeyEvent) gives:

      error: Type annotations are not permitted in function parameters in JavaScript functions
      

      3. Moving the handler to a separate function like this gives another error:

          function handler(event: KeyEvent) : void {
              event.accepted = true;
          }
          Keys.onEscapePressed: handler
      
      Could not compile function handler: Type QVariant of QVariant does not have a property accepted for writing
      

      Or this if event is not used in the function:

      Cannot resolve the argument type KeyEvent.
      

       

       So as of Qt 6.3.1 it's not possible to qualify this event handler.

      Attachments

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

        Activity

          People

            ulherman Ulf Hermann
            knutt Knut Tidemann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes