fix(qt): stop shadowing Item.enabled and Item.palette in four components

SettingsButton, QbzToggle and QbzSelect declared their own `enabled` over
Item's, and ReactiveRingsPanel its own `palette` over Item's QPalette: Qt
flagged all four at start (propertyCache: "overrides a member of the base
object"). The shadowed `enabled` never disabled input by itself — each
control filtered clicks and keys by hand, and any child that did not would
have kept receiving events. The inherited property now drives the visuals,
the focus policy and the guards, and disables the subtree the way Item
does; the rings' colour list is `ringPalette`.

cc
This commit is contained in:
vicrodh committed 2026-09-13 18:35:09 -06:00
1 parent e834f8f52b
commit e70204c8e1
4 files changed
+7 -8

No files matched your search

-1
View File
@@ -26,7 +26,6 @@ Rectangle {
// window edge may opt into a lateral list without changing every other
// QbzSelect instance. Supported values: "below" and "left".
property string popupPlacement: "below"
property bool enabled: true
property bool searchable: false
// Bootstrap-style small variant (QbzSelect.slint:74-76). The default is the
// standard Settings size; TOOLBARS opt in with `sm: true` — 30px tall, r6,
-1
View File
@@ -14,7 +14,6 @@ Rectangle {
id: root
property bool checked: false
property bool enabled: true
signal toggled(bool value)
QbzTheme { id: theme }
@@ -20,7 +20,6 @@ Rectangle {
property string trailingIconName: ""
property bool danger: false
property bool busy: false
property bool enabled: true
// The two metrics the MyQBZ modal footers and the Disco builder need. The
// Slint's SecondaryButton is 34px/min-160 in Settings and 38px/hug in a
// modal footer, which is one control with two call-site numbers — not two
@@ -53,7 +53,9 @@ Rectangle {
readonly property color primaryColor: QbzShell.ambientPrimary
readonly property color accentColor: QbzShell.ambientAccent
readonly property color secondaryColor: QbzShell.ambientSecondary
readonly property var palette: [
// `ringPalette`, not `palette`: Item already owns a `palette` (QPalette)
// and shadowing it drew a propertyCache warning on every start.
readonly property var ringPalette: [
root.primaryColor,
root.accentColor,
root.secondaryColor,
@@ -65,15 +67,15 @@ Rectangle {
readonly property var bandNames: ["SUB", "BASS", "MID", "PRES", "AIR"]
function paletteColor(position, alpha) {
var count = root.palette.length
var count = root.ringPalette.length
var wrapped = position % count
if (wrapped < 0)
wrapped += count
var lo = Math.floor(wrapped)
var hi = (lo + 1) % count
var mix = wrapped - lo
var a = Qt.lighter(root.palette[lo], 1.0)
var b = Qt.lighter(root.palette[hi], 1.0)
var a = Qt.lighter(root.ringPalette[lo], 1.0)
var b = Qt.lighter(root.ringPalette[hi], 1.0)
return Qt.rgba(a.r + (b.r - a.r) * mix,
a.g + (b.g - a.g) * mix,
a.b + (b.b - a.b) * mix,
@@ -181,7 +183,7 @@ Rectangle {
"speed": 0.006 + intensity * 0.013,
"color": root.nextColor
})
root.nextColor = (root.nextColor + 1) % root.palette.length
root.nextColor = (root.nextColor + 1) % root.ringPalette.length
if (next.length > root.maxPulseRings)
next.shift()
}