Bug 410672

Summary: Provide a property to control the invisible click/scroll area around the slider
Product: [Frameworks and Libraries] frameworks-qqc2-desktop-style Reporter: Nate Graham <nate>
Component: generalAssignee: Marco Martin <notmart>
Status: RESOLVED FIXED    
Severity: wishlist CC: kde
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=410671
Latest Commit: Version Fixed In: 5.86

Description Nate Graham 2019-08-06 21:17:04 UTC
Sliders allow the user to click on different parts of them to make the handle zoom to the clicked location, or move the handle by scrolling while the cursor is over the slider. Also, the clickable/scrollable area is bigger than the actual slider body itself; you don't have to have the cursor right one of the pixels for the track or the handle.

In certain circumstances, it's desirable to have this area that accepts clicks and scrolls to be even larger than usual. In Elisa, we have a use for this: we put the playback slider in a horizontal bar and we want to have the clickable/scrollable area extend to the full height of the bar (See Bug 408703 for details and background). We currently implement this with a custom mousearea and custom styling for the control itself (https://cgit.kde.org/elisa.git/tree/src/qml/MediaPlayerControl.qml#n194) but we realize that this is not ideal and we would like to be more upstream-friendly.

If the slider control itself exposed a property for the invisible scroll/click area, then we could use that and not re-implement the whole thing from scratch.

I was unsure if Qt or the desktop style was the correct place to implement this, so please let me know if this isn't right.
Comment 1 Nate Graham 2021-03-18 17:11:16 UTC
Nope; we don't add theme-specific API to QQC2 stuff.
Comment 2 Nate Graham 2021-08-13 20:41:31 UTC
Git commit 9e4d34b2d4850448b0ff2ac391c5f11b446913a4 by Nate Graham.
Committed on 13/08/2021 at 20:41.
Pushed by ngraham into branch 'master'.

Vertically center slider

Normally this happens automatically, but if you manually override the
height of a slider, then the bar and handle become top-aligned within
the larger-than-normal bounding box rather than being vertically
centered. Why would you want to override the height of a slider? To
provide a larger-than-normal click/drag/scroll areas for use cases
that benefit from this, such as the playback slider of a music player
app.

This commit makes the control alwayes be vertically entered within its
bounding box when the height of that box is manually overridden.
FIXED-IN: 5.86

M  +4    -1    org.kde.desktop/Slider.qml

https://invent.kde.org/frameworks/qqc2-desktop-style/commit/9e4d34b2d4850448b0ff2ac391c5f11b446913a4