Skip to content

Commit

Permalink
Avoid removing battery from gauge model
Browse files Browse the repository at this point in the history
It should always be present, even if it is not shown due to user
preferences.
  • Loading branch information
blammit committed Jul 18, 2023
1 parent a8acd37 commit 8cf004b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions components/GaugeModel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ ListModel {

function refresh() {
const gaugeIndex = root.findGauge(gaugeObject)
if (isBattery && gaugeIndex < 0) {
root.addGauge(gaugeObject)
if (isBattery) {
if (gaugeIndex < 0) {
root.addGauge(gaugeObject)
}
} else if (gaugeIndex >= 0 && tankModel.count === 0) {
root.remove(gaugeIndex)
} else if (gaugeIndex < 0 && tankModel.count > 0) {
Expand Down

0 comments on commit 8cf004b

Please sign in to comment.