pragma ComponentBehavior: Bound import QtQuick import "../services" import "../theme" Item { id: root implicitHeight: 28 property bool mounted: false property bool subscribed: false function sync() { const next = mounted && visible; if (next !== subscribed) { CavaService.consumers += next ? 1 : -1; subscribed = next; } } Component.onCompleted: { mounted = true; sync(); } Component.onDestruction: { if (subscribed) CavaService.consumers--; } onVisibleChanged: sync() Row { anchors.fill: parent spacing: 3 Repeater { model: 24 Rectangle { required property int index width: Math.max(1, (root.width - 69) / 24) height: Math.max(2, root.height * (CavaService.bars[index] || 0)) y: root.height - height radius: 2 color: Theme.accent } } } }