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.
Nope; we don't add theme-specific API to QQC2 stuff.
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
This commit makes the control alwayes be vertically entered within its
bounding box when the height of that box is manually overridden.
M +4 -1 org.kde.desktop/Slider.qml