Bug 458563 - Sliders and scrollbars don't follow the mouse accurately
Summary: Sliders and scrollbars don't follow the mouse accurately
Status: ASSIGNED
Alias: None
Product: frameworks-qqc2-desktop-style
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.101.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: ratijas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-31 16:23 UTC by Jack Hill
Modified: 2023-09-07 11:15 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jack Hill 2022-08-31 16:23:51 UTC
SUMMARY
The duration handle is "biased" towards the centre of the slider. So when I click somewhere on the left-hand side of the slider, the handle is placed slightly to the right of the mouse pointer. Similarly when I click somewhere on the right-hand side of the slider, the handle is placed slightly to the left of the mouse pointer.

This is an issue because sometimes I want to go back a couple of seconds, so I'll click just to the left of the handle. If the handle is far to the left, then the audio actually jumps forwards. If the handle is to the far to the right, then the audio jumps backwards significantly more than I expect it to.

The problem also exists in Kasts and Koko, but not in Haruna. (maybe because it uses mpv instead of Qt Multimedia, or maybe because it uses a custom slider?)

STEPS TO REPRODUCE
1. Start playing a song
2. Click somewhere on the far left of the slider

OBSERVED RESULT
The handle is placed slightly to the right of the mouse pointer

EXPECTED RESULT
The handle should be placed on the mouse pointer

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20220829
KDE Plasma Version: 5.25.4
KDE Frameworks Version: 5.97.0
Qt Version: 5.15.5
Kernel Version: 5.19.2-1-default (64-bit)
Graphics Platform: X11

ADDITIONAL INFORMATION
Comment 1 Yerrey Dev 2022-09-04 00:16:39 UTC
This is seems like an issue with the QML Slider and I've made a bug report at https://bugreports.qt.io/browse/QTBUG-106229. 

I'm not sure if they're going to fix it or if this is just something we should workaround, though the workaround is quite simple by setting the handle width explicitly.
Comment 2 Jack Hill 2023-01-10 14:12:05 UTC
I think it's actually a qqc2-desktop-style bug, because
1) I can't reproduce when building a fresh Qt app from Qt Creator, and
2) The same issue occurs with scrollbars

To reproduce the scrollbar issue:
1) Open NeoChat
2) Open a room with a large number of members, e.g. #kde-welcome:kde.org
3) Open the room sidebar (with the header "Room information")
4) Use the scrollbar beside the members list

You'll notice that when you hold the mouse down on the handle:
* If the handle is at the top of the scrollbar, then the cursor is at the top of the handle
* If the handle is at the bottom of the scrollbar, then the cursor is at the bottom of the handle

Also try placing the handle at the very top, and then clicking the centre of the handle. The scrollbar will jump down slightly.
Comment 3 Noah Davis 2023-01-10 14:34:12 UTC
For the slider: Yeah, this is what happens when you don't allow the handle of a slider to stick out of the bounds of the groove. A handle all the way to the left or right should be centered on the point where the rounded part of the groove ends. The handle shouldn't be out of the bounds of the slider, but the groove can be made a bit shorter with margins added to compensate. This might require some work on the Breeze QStyle to properly fix.

For the scrollbar: Not really sure what's going on with that or what should be done to fix it. A scrollbar handle needs to stay in the bounds of the scrollbar groove, so the above fix for slider doesn't apply.
Comment 4 ratijas 2023-09-07 11:15:39 UTC
For sliders it was fixed in https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/272

ScrollBars are still on their way to greatness tho…