qtsubclassingqpainterpainteventqslider

How to draw a picture instead of the slider of a QSlider?


I have created a class that inherits from QSlider and I want to draw a picture on the slider (grabber) instead of showing the plain one.

How to do it?


Solution

  • You can do it into the paintEvent method of the widget. This allows you to redraw all or only a part of the widget.