QSlider styling: making space to the right
-
I would like to add another widget to a QSlider, but I would like that class to be a subclass of QSlider itself so it becomes a drop-in replacement. I am running into a bit of a dead-end however. I tried to just reimplement the paintEvent, but the QSlider paint event relies on the internal d pointer thing for its state, so that is hard to access. I also tried to use style sheets to create some space next to slider, but the normal slider does not budge for properties like margin-right or padding-right. Only if I really modify the groove and the handle do I get some results, but that of course results in a non-standard looking slider, which is something I want to avoid.
I don't quite get why the default slider does not work with the padding and margin style sheet properties.
I know I can create my own QWidget derived class, which simply contains the QSlider and what I want to put next to it in a layout, but that would not make it a drop-in replacement that is completely compatible with QSlider, and it would means a lot of boilerplate code to re-implement all the QSlider methods in my API.
Any suggestions?