import QtQuick import "../components" import "../theme" // Ring gauge (0–100) with a centred label; null values draw an empty ring. Item { id: root property var value: null property int size: 92 property real thickness: 8 property color color: Theme.accentVivid property string label: value === null || value === undefined || !Number.isFinite(value) ? "—" : Math.round(value) + "%" property string caption: "" implicitWidth: size implicitHeight: size JumpValue { id: level target: Number.isFinite(root.value) ? Math.max(0, Math.min(100, root.value)) : 0 } readonly property real shown: level.value onShownChanged: canvas.requestPaint() onColorChanged: canvas.requestPaint() Canvas { id: canvas anchors.fill: parent onPaint: { const c = getContext("2d"), r = (width - root.thickness) / 2, start = Math.PI * 0.75, sweep = Math.PI * 1.5; c.reset(); c.lineCap = "round"; c.lineWidth = root.thickness; c.strokeStyle = Qt.alpha(Theme.text, 0.1); c.beginPath(); c.arc(width / 2, height / 2, r, start, start + sweep); c.stroke(); if (root.shown > 0) { c.strokeStyle = root.color; c.beginPath(); c.arc(width / 2, height / 2, r, start, start + sweep * root.shown / 100); c.stroke(); } } } Column { anchors.centerIn: parent Text { anchors.horizontalCenter: parent.horizontalCenter text: root.label color: Theme.text font.pixelSize: Math.round(root.size * 0.21) font.weight: Font.DemiBold font.features: { "tnum": 1 } } Text { anchors.horizontalCenter: parent.horizontalCenter visible: text !== "" text: root.caption color: Theme.textSecondary font.pixelSize: Math.max(9, Math.round(root.size * 0.11)) } } }