Qt widen QScrollBar when hover using StyleSheet

  • I'm trying to change the width of a vertical QScrollBar with a custom stylesheet like
    border: 2px solid grey;
    background: #32CC99;
    width: 10px;
    margin: 22px 0 22px 0;
    QScrollBar:vertical:hover {
    background: red;
    width: 25px ;

    It doesn't work. Did I make any mistake? Can't we change the width of widget in run-time?

  • I have the solution. I sub classed QScrollBar and set the style sheet in enterEvent and leaveEvent. It works fine for me.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.