I have tried several things to get QScrollBar’s slider to change size based on the number of singleSteps(). I would like the stepSize() to be ~1.
The following link has got me the closest, but I can’t seem to get it to work.
http://www.qtcentre.org/threads/2133-QScrollBar-custom-slider-s-size
What do I need to do to get the slider size to change? I would post code, however like I said above I have tried many different attempts, I would like to clean off my slate and just see a nice clean example of how to change the slider size.
Normally the size of the slider is supposed to represent the size of the visible part of the scrolled content. That’s what
QAbstractSlider‘s API was designed to do.If you want to lock the size of the visible part to be some integer multiple of a non-integer overall size of the content, then the idiomatic way to approach it is to rescale the output of the scrollbar by a non-integer factor
height / (maximum() + pageStep()). The logical height (length) of the document maps tomaximum() + pageStep(). You can of course setsingleStep()to be equal topageStep().Given some
numStripsandheight, proceed as follows: