From 4a8091cd4137c461595e6f9a54855ef7a7cd79e3 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 28 Jul 2026 07:55:29 -0700 Subject: [PATCH] Give PanelSlider a right-click signal Sliders only ever accepted the left button. Audio wants right-click as a secondary action on the track, so emit rightClicked() for it and keep dragging left-button-only: press and release both ignore anything else, so a right-click can neither start a drag nor move the value. Co-Authored-By: Claude Opus 5 (1M context) --- shell/Ui/PanelSlider.qml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/shell/Ui/PanelSlider.qml b/shell/Ui/PanelSlider.qml index f695f124..d7bf1303 100644 --- a/shell/Ui/PanelSlider.qml +++ b/shell/Ui/PanelSlider.qml @@ -30,6 +30,10 @@ Item { signal moved(real value) signal released(real value) + // Right-click is a secondary action on the whole track — audio uses it to + // mute the channel the slider belongs to. Dragging stays left-button only. + signal rightClicked() + implicitWidth: Style.space(200) implicitHeight: Math.max(Style.space(22), knobSize + Style.spacing.md) @@ -102,7 +106,7 @@ Item { anchors.fill: parent hoverEnabled: true cursorShape: Qt.PointingHandCursor - acceptedButtons: Qt.LeftButton + acceptedButtons: Qt.LeftButton | Qt.RightButton function valueFromX(x) { var clamped = Math.max(0, Math.min(track.width, x)) @@ -112,11 +116,15 @@ Item { } onPressed: function(mouse) { + if (mouse.button !== Qt.LeftButton) return root.dragging = true var next = valueFromX(mouse.x) root.liveValue = next root.moved(next) } + onClicked: function(mouse) { + if (mouse.button === Qt.RightButton) root.rightClicked() + } onPositionChanged: function(mouse) { if (!root.dragging) return var next = valueFromX(mouse.x) @@ -124,6 +132,7 @@ Item { root.moved(next) } onReleased: function(mouse) { + if (mouse.button !== Qt.LeftButton) return root.dragging = false root.released(root.liveValue) root.liveValue = root.value