Important: Please read the Qt Code of Conduct -

Changing the color of the handle of a vertical QSlider looses the shape and the other states

  • This is the normal behavior of the handle of the slider

    disable_or_pressed.png !

    I want this but change the blue color for rgb(72, 66, 66) .

    I tried to change the blue color like this

    QSlider::handle:vertical {
    	height: 4px;
    	background-color: rgb(72, 66, 66);
     	margin: 0 -4px; /* expand outside the groove */
    	border-radius: 8px;
    	width: 8px;

    But it looses the shape and looses the hover and disable state. It always looks like this


    How can I change the color without loosing the shape and the other states?

  • Lifetime Qt Champion

    Stylesheets are all or nothing.
    As soon as you apply a stylesheet to a widget, the normal drawing is
    no longer in effect/changes.

    So you have to style all of it. including the shape to look like it used to
    and hover effects.

    QSlider::handle:vertical:hover {
    background-color: rgb(...);

    So thats one of the downsides with stylesheets.

Log in to reply