I don't think there is a way of doing this by using the stylesheets alone.
You could create your own scrollbar and override the enterEvent
and leaveEvent
and change the stylesheet there.
You could also install an event filter to your existing scrollbar (you can get your scrollbar by using the QAbstractScrollArea::verticalScrollBar()
function) and listen to the same events and change the stylesheet there.