Bug 478437

Summary: Plasma Components Slider does not respect step size when using scroll wheel to change value.
Product: [Frameworks and Libraries] libplasma Reporter: Trần Nam Tuấn (Bill) <tuantran1632001>
Component: componentsAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED UPSTREAM    
Severity: minor CC: me, notmart
Priority: NOR    
Version: 5.246.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Test QML file.
Demonstrate video

Description Trần Nam Tuấn (Bill) 2023-12-12 15:02:07 UTC
Created attachment 164111 [details]
Test QML file.

The Slider component does not seem to respect step size when using scroll/mouse wheel to change its value. I encounter this on my laptop with a touchpad.

The Slider is an item in a PlasmoidItem. Its value is bound to a Label to be displayed. The step size is set to an integer.
Snap mode is set to SnapAlways.

If I use my mouse click to drag the slider knob, the value is change as expected. If the mouse wheel is used, the value jumps into a non integer value.

This behavior does not exist with vanilla QQC.
Comment 1 Trần Nam Tuấn (Bill) 2023-12-12 15:02:46 UTC
Created attachment 164112 [details]
Demonstrate video
Comment 2 Trần Nam Tuấn (Bill) 2023-12-12 16:05:39 UTC
Upon looking closer at the code, Plasma Components Slider has wheelEnabled set to true by default. If I set this property to true in QQC Slider, this bug also happens.

However, If I set the property to false, scrolling using touchpad still work with QQC Slider but doesn't work with Plasma Components Slider.
Comment 3 ratijas 2023-12-12 16:30:15 UTC
See https://bugreports.qt.io/browse/QTBUG-93081
Comment 4 ratijas 2023-12-12 16:33:40 UTC
> However, If I set the property to false, scrolling using touchpad still work with QQC Slider but doesn't work with Plasma Components Slider.

Also we do have custom logic in our qqc2-desktop-style Slider.qml:
https://invent.kde.org/frameworks/qqc2-desktop-style/-/blob/f159a5d64ecd52dd3e75588759b7ce7838014bc4/org.kde.desktop/Slider.qml#L52-83

which we never ported to Plasma because it's such an ugly hack
Comment 5 Trần Nam Tuấn (Bill) 2023-12-12 16:48:48 UTC
Well then. For now, I'm just going to round the value to the nearest integer as a workaround.