[SOLVED]How can I style QScrollArea scrollbars



  • How can I style QScrollArea scrollbars using qss?

    I tried to use the following but it didn't work!
    [code]#scrollArea_main QScrollBar:horizontal {
    border: 2px solid grey;
    background: #32CC99;
    height: 15px;
    margin: 0px 20px 0 20px;
    }
    #scrollArea_main QScrollBar::handle:horizontal {
    background: white;
    min-width: 20px;
    }
    #scrollArea_main QScrollBar::add-line:horizontal {
    border: 2px solid grey;
    background: #32CC99;
    width: 20px;
    subcontrol-position: right;
    subcontrol-origin: margin;
    }
    #scrollArea_main QScrollBar::sub-line:horizontal {
    border: 2px solid grey;
    background: #32CC99;
    width: 20px;
    subcontrol-position: left;
    subcontrol-origin: margin;
    }[/code]

    P.S. I'm using Qt 5.2.1 with Mint x64 and Windows 7 32bit


  • Moderators

    Hi,

    Can you show he code where you use the stylesheet.

    Did you try it outin Qt Creator? That's a good place to play around with stylesheets and avoid typos.



  • Thank you guys, I found out this solution from "QDarkStyleSheet":https://github.com/ColinDuquesnoy/QDarkStyleSheet qss

    P.S. I added it to "CSSBased style wiki page":http://qt-project.org/wiki/Style-CSSBased


Log in to reply
 

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