From a2465fd5420d5d9a397ec704409a0be1389a1e4f Mon Sep 17 00:00:00 2001 From: chenyuanbo Date: Thu, 7 May 2026 14:27:02 +0800 Subject: [PATCH] fix(slider): adjust path calculation for handle alignment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When handleType is NoHandleType, the x-coordinate calculation now calculates based on sliderGroove to correct the visual alignment of the slider path. Log: adjust path calculation for handle alignment PMS: BUG-358623 Influence: 检查输入设备的反馈音量显示是否正确,同时关注静音场景(PMS:350837) --- qt6/src/qml/Slider.qml | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/qt6/src/qml/Slider.qml b/qt6/src/qml/Slider.qml index 8a8ce8ec8..4c1e03fcd 100644 --- a/qt6/src/qml/Slider.qml +++ b/qt6/src/qml/Slider.qml @@ -17,7 +17,8 @@ T.Slider { ArrowUp = 2, ArrowLeft = 3, ArrowBottom = 4, - ArrowRight = 5 + ArrowRight = 5, + NoArrowType = 6 } property D.Palette grooveColor: DS.Style.slider.groove.background @@ -100,16 +101,29 @@ T.Slider { startX: control.horizontal ? (control.alignToTicks ? __handle.width / 2 : 0) : sliderGroove.width / 2 startY: control.horizontal ? sliderGroove.height / 2 : sliderGroove.height PathLine { - x: control.horizontal ? control.handle.x : sliderGroove.width / 2 - y: control.horizontal ? sliderGroove.height / 2 : control.handle.y + control.handle.height / 2 + x: control.horizontal ? (control.handleType === Slider.HandleType.NoArrowType + ? control.visualPosition * sliderGroove.width + : control.handle.x) : sliderGroove.width / 2 + y: control.horizontal ? sliderGroove.height / 2 + : (control.handleType === Slider.HandleType.NoArrowType + ? control.visualPosition * sliderGroove.height + : control.handle.y + control.handle.height / 2) } } Item { id: passItem - y: control.horizontal ? -DS.Style.slider.groove.height / 2 : control.handle.y + control.handle.height / 2 - height: control.horizontal ? DS.Style.slider.groove.height : sliderGroove.height - control.handle.y - control.handle.height / 2 - width: control.horizontal ? control.handle.x : DS.Style.slider.groove.height + y: control.horizontal ? -DS.Style.slider.groove.height / 2 + : (control.handleType === Slider.HandleType.NoArrowType + ? control.visualPosition * sliderGroove.height + : control.handle.y + control.handle.height / 2) + height: control.horizontal ? DS.Style.slider.groove.height + : (control.handleType === Slider.HandleType.NoArrowType + ? sliderGroove.height - control.visualPosition * sliderGroove.height + : sliderGroove.height - control.handle.y - control.handle.height / 2) + width: control.horizontal ? (control.handleType === Slider.HandleType.NoArrowType + ? control.visualPosition * sliderGroove.width + : control.handle.x) : DS.Style.slider.groove.height } BoxShadow {