Click anywhere linear slider inc/decrements value?


I would like to click on the slider bar (the non-thumb part) so that the slider value increments/decrements by the step-size set in setRange.

Clicking to the right of thumb would increment, to the left of thumb would decrement.

Is this possible?

(So the behaviour would be similar to an OS scrollbar, where you can page down if you click below the handle)

Many thanks in advance!



I had a quick look into it and unfortunately there seems to be no easy way to accomplish this at the moment. The parts of functionality that you would need here are buried quite deep inside the Slider implementation.

The Slider class is not ideal in many aspects and there is a chance that we will refactor it at some point in the future. Until then - unless anyone else has a better idea - I would suggest that you take a look at the mouseUp/mouseDown implementation in Slider, and at the behaviour for SliderStyle::IncDecButtons (which already does what you want, but unfortunately with extra buttons) - maybe it can be done by combining the code in there?


How about a ScrollBar with your own LookAndFeel?



Thanks for the replies!

I think both solutions would be above me right now. I will take a look when I gain more knowledge.

All the best,