Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
Qt Creator 4.10.0
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)