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

Qt creator automatically formats QML file even though "Enable auto format on file save" is disabled.

    XMLWordPrintable

Details

    • Windows

    Description

      Often I find myself in need of "if ... else-if ... else-if ... ... else ..." expression binding to QML property. I write it like this:

      	property string example_text
      	property string error
      	color: error !== ""             ? "red"    :
      	       example_text.length > 10 ? "yellow" :
      	                                  "green"
      

      now when I hit [CTRL]+S it will be changed to something like this:

      	color: error !== ""             ? "red"    :
      									example_text.length > 10 ? "yellow" :
      									  "green"
      

      There are three issues with this:

      • I did not enable option "Enable auto format on file save" (This is the biggest one by far)
      • I have chosen to align continuation lines with spaces, but instead they are converted to tabs
      • QtCreator tries to align second condition under the if-value of first condition. It makes more sense for chained conditions to be formatted in two columns: condition under condition, value under value (last value doesn't have a condition)

      Attachments

        Activity

          People

            Unassigned Unassigned
            bartekbl Bartosz Błaszkiewicz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: