Skip to content

Commit bdc27e7

Browse files
52cybdeepin-bot[bot]
authored andcommitted
fix(slider): adjust path calculation for handle alignment
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)
1 parent 4921481 commit bdc27e7

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

qt6/src/qml/Slider.qml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ T.Slider {
1717
ArrowUp = 2,
1818
ArrowLeft = 3,
1919
ArrowBottom = 4,
20-
ArrowRight = 5
20+
ArrowRight = 5,
21+
NoArrowType = 6
2122
}
2223

2324
property D.Palette grooveColor: DS.Style.slider.groove.background
@@ -100,16 +101,29 @@ T.Slider {
100101
startX: control.horizontal ? (control.alignToTicks ? __handle.width / 2 : 0) : sliderGroove.width / 2
101102
startY: control.horizontal ? sliderGroove.height / 2 : sliderGroove.height
102103
PathLine {
103-
x: control.horizontal ? control.handle.x : sliderGroove.width / 2
104-
y: control.horizontal ? sliderGroove.height / 2 : control.handle.y + control.handle.height / 2
104+
x: control.horizontal ? (control.handleType === Slider.HandleType.NoArrowType
105+
? control.visualPosition * sliderGroove.width
106+
: control.handle.x) : sliderGroove.width / 2
107+
y: control.horizontal ? sliderGroove.height / 2
108+
: (control.handleType === Slider.HandleType.NoArrowType
109+
? control.visualPosition * sliderGroove.height
110+
: control.handle.y + control.handle.height / 2)
105111
}
106112
}
107113

108114
Item {
109115
id: passItem
110-
y: control.horizontal ? -DS.Style.slider.groove.height / 2 : control.handle.y + control.handle.height / 2
111-
height: control.horizontal ? DS.Style.slider.groove.height : sliderGroove.height - control.handle.y - control.handle.height / 2
112-
width: control.horizontal ? control.handle.x : DS.Style.slider.groove.height
116+
y: control.horizontal ? -DS.Style.slider.groove.height / 2
117+
: (control.handleType === Slider.HandleType.NoArrowType
118+
? control.visualPosition * sliderGroove.height
119+
: control.handle.y + control.handle.height / 2)
120+
height: control.horizontal ? DS.Style.slider.groove.height
121+
: (control.handleType === Slider.HandleType.NoArrowType
122+
? sliderGroove.height - control.visualPosition * sliderGroove.height
123+
: sliderGroove.height - control.handle.y - control.handle.height / 2)
124+
width: control.horizontal ? (control.handleType === Slider.HandleType.NoArrowType
125+
? control.visualPosition * sliderGroove.width
126+
: control.handle.x) : DS.Style.slider.groove.height
113127
}
114128

115129
BoxShadow {

0 commit comments

Comments
 (0)