Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-26874

QMLJSEditor removes types from function signature

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • Qt Creator 6.0.1
    • Quick / QML Support
    • None
    • Ubuntu 20.04.3 LTS
    • Linux/X11

    Description

      I'm playing with the code from your QT6 documentation and when I'm trying to auto-format (ReformatFile) copied code, the editor remove types from function signature. So after saving this code:

          Item {
              function myQmlFunction(msg: string) : string {
                  console.log("Got message:", msg)
                  return "some return value"
              }
          }

      I get 

          Item {
              function myQmlFunction(msg) {
                  console.log("Got message:", msg)
                  return "some return value"
              }
          }
      

      And then the compiler can't bind these functions together (because msg becomes a QVariant type):

      W libdictionary_x86_64.so: QMetaObject::invokeMethod: No such method QQuickItem_QML_16::myQmlFunction(QString)
      W libdictionary_x86_64.so: Candidates are:
      W libdictionary_x86_64.so:     myQmlFunction(QVariant)
      

      Attachments

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

        Activity

          People

            qtqmlteam Qt Qml Team User
            cocojambo Vitaliy S
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes