diff --git a/shell/Ui/PanelSlider.qml b/shell/Ui/PanelSlider.qml index f8359bb5..f695f124 100644 --- a/shell/Ui/PanelSlider.qml +++ b/shell/Ui/PanelSlider.qml @@ -18,6 +18,13 @@ Item { property real knobSize: Math.max(14, Math.round(Style.spacing.controlHeight * 0.38)) property real liveValue: value + // macOS-style notches. When > 1, that many evenly-spaced tick marks are cut + // into the track (drawn in the panel background color, so only the part + // crossing the track shows). Purely visual — snapping is the caller's job via + // `integer`/`step` or an index-based value. Default 0 leaves the track plain. + property int tickCount: 0 + property color tickColor: bar ? bar.background : Color.background + onValueChanged: if (!dragging) liveValue = value signal moved(real value) @@ -55,6 +62,20 @@ Item { } } + Repeater { + model: root.tickCount > 1 ? root.tickCount : 0 + Rectangle { + required property int index + width: Math.max(1, Style.space(2)) + height: root.trackHeight + Style.space(4) + radius: 1 + color: root.tickColor + anchors.verticalCenter: track.verticalCenter + x: Math.max(0, Math.min(track.width - width, + track.width * (index / (root.tickCount - 1)) - width / 2)) + } + } + BorderSurface { id: knob width: root.knobSize