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

Reformating QML file breaks property declaration using qualified local namespace

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Not Evaluated
    • None
    • Qt Creator 4.7.0
    • Quick / QML Support
    • None
    • Linux/X11

    Description

      When a QML module is imported with a qualified name inside a file, when the file is reformatted (using QmlJSEditor > ReformatFile), any property declared with the type prefixed by the local namespace qualifier is broken. After the reformat the type of the property is removed leaving only the local namespace.

      // example.qml
      import QtQuick.Controls 2.4 as QtControls
      
      // before reformatting
      property QtControls.ToolButton toolButton: QtControls.ToolButton {
          id: myTool
      }
      
      signal someSignal(QtControls.ToolButton control)
      
      // after reformatting
      property QtControls toolButton: QtControls.ToolButton {
          id: myTool
      }
      
      signal someSignal(QtControls control)
      

      This is very subtle and hard to catch since its not marked as an error inside the editor. Any attempt to execute the program just end with the typical

       /path/to/exe exited with code 255 

      EDIT: Added signal declaration to example.

      Attachments

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

        Activity

          People

            mabenell Marco Benelli
            errpell Nhatz HK
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes