How can I set the shadow to slider handle of a QScrollBar like this required style?
Inherited a class from QScrollBar, configured QStyleSheet as in the picture, tried to add a GraphicsEffect, but it is added to the whole QScrollBar, but not to the Slider
Not sure if this helps, but you could try with the following methods and apply your QGraphicsEffect
after getting the style from the subcontrol, or even passing the right painter
to the method drawComplexControl
:
https://doc.qt.io/qt-5/qstyle.html#subControlRect
https://doc.qt.io/qt-5/qstyle.html#drawComplexControl
https://doc.qt.io/qt-5/qgraphicseffect.html#draw
I know that you can access to the QRect for the slider, but I don't know if this can inspire you in your quest.
QRect handleRect = style()->subControlRect(QStyle::CC_ScrollBar, &option, QStyle::SC_ScrollBarSlider, this);