Details
-
Suggestion
-
Resolution: Unresolved
-
P2: Important
-
None
Description
Sometimes, we want to maintain our line breaks for readability, but qmlformat squeezes them into single lines.
It would be great to have a mechanism to prevent this. (Using comments to disable formatting for specific blocks, perhaps? QTBUG-97796 )
qmlformat inputs (already good)
// From https://github.com/qt/qtdeclarative/blob/v6.8.0/src/quickcontrols/basic/TreeViewDelegate.qml#L22-L25 import QtQuick import QtQuick.Controls.impl import QtQuick.Templates as T T.TreeViewDelegate { id: control highlighted: control.selected || control.current || ((control.treeView.selectionBehavior === TableView.SelectRows || control.treeView.selectionBehavior === TableView.SelectionDisabled) && control.row === control.treeView.currentRow) }
import QtQml QtObject { function getBatteryAdvice(batteryLevel_pct : int) : string { return batteryLevel_pct > 40 ? `Battery OK. ${batteryLevel_pct}% remaining.` : `Only ${batteryLevel_pct}% remaining. Please recharge.` } }
qmlformat outputs (made worse)
// From https://github.com/qt/qtdeclarative/blob/v6.8.0/src/quickcontrols/basic/TreeViewDelegate.qml#L22-L25 import QtQuick import QtQuick.Controls.impl import QtQuick.Templates as T T.TreeViewDelegate { id: control highlighted: control.selected || control.current || ((control.treeView.selectionBehavior === TableView.SelectRows || control.treeView.selectionBehavior === TableView.SelectionDisabled) && control.row === control.treeView.currentRow) }
import QtQml QtObject { function getBatteryAdvice(batteryLevel_pct : int) : string { return batteryLevel_pct > 40 ? `Battery OK. ${batteryLevel_pct}% remaining.` : `Only ${batteryLevel_pct}% remaining. Please recharge.`; } }
Attachments
Issue Links
- is covered by
-
QTBUG-97796 qmlformat: Implement disabling formatting via comments
- Reported
- relates to
-
QTBUG-116755 qmlformat: creates lines over 100 characters long
- In Progress