Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Modify QSlider Groove visualisation
Bowdzone last edited by
I'm trying to create a QSlider for modifying a line thickness. Now my idea with this was to use the groove from the slider to represent the current thickness but it is giving me more trouble than it should.
As there is no direct way to change the groove size, I tried doing that with stylesheets but the "height" or "width" property for QSlider::groove:horizontal by itself have no effect. This has also the problem that as soon as you change the appearance of the groove, the handle is not drawn anymore in the default style. As this is a cross-platform program which is using different styles in linux/windows I want to keep the default handle style.
Now it is no problem at all to override the paintEvent() (which is called on each handle movement anyway) and simply draw a line according to the current slider value which works fine. But here I would just need to remove the existing groove. I'd really prefer to not copy the whole paint routine from the src for the different styles we're using.
Does anyone have an idea? Any help is greatly appreciated.
PS: We're using 4.6