Set AutoRepeat for QScrollbar?
I use a QScrollbar to move within a graphical representation (viewport/canvas kind of thing). I want the user to be able to position the viewport pixel-perfect, therefore I need a singleStep of 1.
With the default autoRepeat interval of 50 ms, this means a user can only scroll 20 pixels per second that way. There's plenty of CPU power left, so I would like to reduce the interval to 10 or 20 ms.
How can I do that?
AFAIK, the keyboard auto-repeat is an OS wide feature that you can't just modify for your application. What you can try to do is take a look at QAbstractButton's documentation to see how they did it and apply it to your scrollbars
Hope it helps
I was talking about the repeatTime parameter of the protected setRepeatAction parameter. It defaults to 50 ms. It looks like it was intended to be changed, but I can't find the interface for it.
I completely missed that one ! From what it look, you can play with it from a subclass, so I'd create a subclass of QScrollBar and either change it in the constructor or add a setter to allow to modify it dynamically
There's a catch to that: setRepeatAction is used within QScrollbar, but it's not virtual, so I cannot overload it with a different interval (which would be an ugly way to do it, anyway).
The only way I see that I could really make use of it would be to re-write QScrollbar myself. I was hoping to avoid that.
I did not meant to reimplement setRepeatAction, just use it in a subclass