Open blammit opened 1 month ago
Thoughts on possible solutions:
For example, perhaps QuantityInfo could be used in a list model like this, and each QuantityInfo object is modified when its quantity value changes, so only the delegate for that entry needs to be updated:
ListQuantityGroup {
textModel: ObjectModel {
QuantityInfo { value: 5.1, unit: VenusOS.Units_Volt_DC },
QuantityInfo { value: 48, unit: VenusOS.Units_Watt }
}
}
Or just use QuantityLabel directly and insert separators:
ListQuantityGroup {
textModel: ObjectModel {
QuantityLabel { value: 5.1, unit: VenusOS.Units_Volt_DC },
QuantitySeparator {}
QuantityLabel { value: 48, unit: VenusOS.Units_Watt }
}
}
If separators were manually specified, rather than inserted automatically as per QuantityRepeater, this would help resolve the issue in PageBatteryDetails where separators are shown unnecessarily. PageBatteryDetails shows the cell ID (a string) and the string may be empty if the cell ID is not available, and in this case, the separator should not be shown between the cell ID and the quantity value.
ListQuantityGroup {
textModel: ObjectModel {
Label { value: details.minVoltageCellId.value; visible: details.minVoltageCellId.isValid }
QuantitySeparator { visible: details.minVoltageCellId.isValid && details.minCellVoltage.isValid }
QuantityLabel { value: details.minCellVoltage.value; unit: VenusOS.Units_Volt_DC; precision: 3 }
}
}
ListQuantityGroup and ListTextGroup are assembled using array-based models like this:
This is conveniently straightforward to specify, but is problematic because when the quantity values change, the array is rebuilt, which in turn causes the delegates to be rebuilt.
So instead, the model should be an updatable object that does not rebuild its list entries when a value is modified.