import QtQuick import QtQuick.Controls import "../theme" // Thick pill slider with an icon inside the track (macOS Control Center style). Slider { id: root property string glyph property string fallback implicitWidth: 220 implicitHeight: 28 padding: 0 background: Rectangle { x: root.leftPadding y: root.topPadding + root.availableHeight / 2 - height / 2 width: root.availableWidth height: root.availableHeight radius: height / 2 color: Theme.surfaceVariant border.width: root.activeFocus ? 1 : 0 border.color: Theme.accent Rectangle { readonly property real knob: parent.height width: Math.max(knob, knob + root.visualPosition * (parent.width - knob)) height: parent.height radius: height / 2 color: root.enabled ? Qt.alpha(Theme.text, 0.92) : Qt.alpha(Theme.text, 0.35) Behavior on width { enabled: !root.pressed NumberAnimation { duration: Theme.duration / 2 easing.type: Easing.OutCubic } } } Text { anchors.left: parent.left anchors.leftMargin: (parent.height - width) / 2 anchors.verticalCenter: parent.verticalCenter text: Icons.available && root.glyph ? root.glyph : root.fallback font.family: Icons.available && root.glyph ? Icons.family : "" font.pixelSize: Math.round(parent.height * 0.5) color: Theme.surface } } handle: Rectangle { x: root.leftPadding + root.visualPosition * (root.availableWidth - width) y: root.topPadding + root.availableHeight / 2 - height / 2 width: root.availableHeight height: root.availableHeight radius: width / 2 color: root.enabled ? Theme.text : Qt.alpha(Theme.text, 0.5) border.width: 1 border.color: Qt.alpha(Theme.surface, 0.5) scale: root.pressed ? 1.06 : 1 Behavior on scale { NumberAnimation { duration: Theme.duration / 2 } } } }