fix(qt): rename on-prefixed QML properties and gate the pattern

A property named `on<Upper>` is filed as a signal handler as soon as a
sibling member `<upper>` exists: its initializer never binds, it sits at
the type default, and nothing warns. `PurchasesView.qml` declared
`onAlbums` next to `albums`, so the Albums tab bound `[]` once and never
re-evaluated, which blanked Purchases for every account with real
purchases. Reproduced standalone with the `qml` runtime: the identical
expression under another name reads `true`.

Rename it to `albumsTab` and the four other `on<Upper>` properties
(`collectionsTab`, `surfaceTint`, `accentFloor`, `litColor`) so the rule
can be exact, and add `qml_on_prefixed_property_audit.py` to the four
QML audit sites (qt-run, cargo-test, test-crates, qt-gate-windows).

cc
This commit is contained in:
vicrodh committed 2026-09-01 23:40:33 -06:00
1 parent 7627ac7a36
commit 1cb988954e
10 files changed
+128 -35

No files matched your search

+6 -6
View File
@@ -115,7 +115,7 @@ Column {
id: led
property string label: ""
property bool on: false
property color onColor: "#22c55e"
property color litColor: "#22c55e"
property string tooltip: ""
implicitWidth: ledRow.implicitWidth
implicitHeight: ledRow.implicitHeight
@@ -139,7 +139,7 @@ Column {
antialiasing: true
color: "transparent"
border.width: 0.75
border.color: led.on ? led.onColor : theme.textMuted
border.color: led.on ? led.litColor : theme.textMuted
Rectangle {
visible: led.on
width: 1.875
@@ -147,7 +147,7 @@ Column {
radius: width / 2
anchors.centerIn: parent
antialiasing: true
color: led.onColor
color: led.litColor
}
}
}
@@ -290,7 +290,7 @@ Column {
visible: QbzPlayer.npCastActive && !QbzPlayer.npIsRemote
label: QbzPlayer.npCastProtocol === "dlna" ? "DLNA" : "CAST"
on: true
onColor: "#a855f7"
litColor: "#a855f7"
tooltip: QbzSession.tr("Casting", QbzSession.trRev)
anchors.verticalCenter: parent.verticalCenter
}
@@ -303,14 +303,14 @@ Column {
DotLed {
label: QbzPlayer.npOutputBackendLabel
on: QbzPlayer.npOutputBackendActive
onColor: "#5b8def"
litColor: "#5b8def"
tooltip: QbzSession.tr("Audio backend", QbzSession.trRev)
anchors.verticalCenter: parent.verticalCenter
}
DotLed {
label: QbzPlayer.npOutputModeLabel
on: QbzPlayer.npOutputModeActive
onColor: "#22c55e"
litColor: "#22c55e"
tooltip: QbzSession.tr("Output mode", QbzSession.trRev)
anchors.verticalCenter: parent.verticalCenter
}