Important: Please read the Qt Code of Conduct -

How to set the size of the handle in a QSlider?

  • I'm trying to add some style to a QSlider I want to use a custom image as the handle that the user drags back and forth. While I've figured out how to use style sheets to have a custom icon drawn where the handle should be, the image is being drawn much too small and I cannot figure out how to make it larger.

    Setting width and height seem to do nothing. I've tried using image, border-image and background-image, but none give me the ability to set the size of the handle image. Does anyone know how to do this?

    This is the style sheet that I've been adding to my QSlider in QtDesigner:

    QSlider::handle:vertical {
        image: url(:/data/icons/mixer-slider-handle.svg);

  • Lifetime Qt Champion

    Try with this
    alt text

    The height of slider handle is linked to height in QSlider::groove:horizontal
    alt text

  • @mrjj

    Okay - this helped. The base size of the image is being set by the groove, but you can also further enlarge the handle image via the margin property on .QSlider::groove:vertical.

Log in to reply