Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
6.5.2
-
None
-
a7f88b189 (dev), 6f2ea69f1 (6.9), c3532b39a (6.8), 7aa9847f3 (tqtc/lts-6.5)
Description
If the developer follows the example in
https://doc.qt.io/qt-6/qml-codingconventions.html#javascript-code
"If the script is a single expression, we recommend writing it inline:
Rectangle { color: "blue"; width: parent.width / 3 }"
And writes e.g.
Button { text: "PRESS ME!"; width: parent.width / 3 }
Qmlformat unnecessarily reformats it:
Button {
text: "PRESS ME!"
width: parent.width / 3
}
That being said, I personally like the the multiline version better from readability point of view. Could it be that the example code in QML Coding Conventions should be updated if qmlformat is already doing the right thing ?
Attachments
For Gerrit Dashboard: QTBUG-116765 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
624791,4 | Doc: update QML codestyle guidelines to prefer multi-line style | dev | qt/qtdoc | Status: MERGED | +2 | 0 |
625676,2 | Doc: update QML codestyle guidelines to prefer multi-line style | 6.9 | qt/qtdoc | Status: MERGED | +2 | 0 |
625845,2 | Doc: update QML codestyle guidelines to prefer multi-line style | 6.8 | qt/qtdoc | Status: MERGED | +2 | 0 |
625927,2 | Doc: update QML codestyle guidelines to prefer multi-line style | tqtc/lts-6.5 | qt/tqtc-qtdoc | Status: MERGED | +2 | 0 |