flat QScrollBar stylesheet



  • i need to make QScrollBar for flat style, without borders, but when i set QScrollBar::add-line or QScrollBar::sub-line it forgot the other properties, for example icon and etc. How can i change only background color and border with save other values in stylesheet?

    QScrollBar {
    background: #444444;
    }

    QScrollBar::sub-page {
    background: #747474;
    }

    QScrollBar::add-page {
    background: #747474;
    }

    alt text

    When added:

    QScrollBar::add-line {
    border: 1px none;
    border-color: #A0A094;
    }

    QScrollBar::sub-line {
    border: 1px none;
    border-color: #A0A094;
    }

    alt text

    Why buttons up / down are lost?


  • Moderators

    @Craetor
    there might be a high chance that once you set the ::add-line and ::sub-line sub-controls via a stylesheet style, you also need to style the whole sub-control.
    Means you wont be able to mix native with stylesheet style for certain (maybe even all?) sub-controls. So you also need to provide the up- and down-arrows as pixmaps and set them via stylesheet.

    See Customizing QScrollBar as reference


Log in to reply
 

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