Change stylesheet



  • Hi,

    I don't know how to change the GUI style.

    I push the right button on, for example, a listWidget, I push change stylesheet. I write

    @
    QScrollBar:vertical {
    border: 2px solid grey;
    background: #32CC99;
    height: 15px;
    margin: 0px 20px 0 20px;
    }
    QScrollBar::handle:vertical {
    background: white;
    min-width: 20px;
    }
    QScrollBar::add-line:vertical {
    border: 2px solid grey;
    background: #32CC99;
    width: 20px;
    subcontrol-position: right;
    subcontrol-origin: margin;
    }

    QScrollBar::sub-line:vertical {
    border: 2px solid grey;
    background: #32CC99;
    width: 20px;
    subcontrol-position: left;
    subcontrol-origin: margin;
    }
    @

    I run, but the style don't change. Should I do something more?

    My qt versión is the following

    Qt Creator 2.1.0
    Based on Qt 4.7.1 (32 bit)

    Built on Mar 22 2011 at 13:04:36

    From revision e80bb4437c


  • Moderators

    If you try your code with a horizontal QScrollBar you will see the results you want.
    If you use it on a vertical one you will not.

    You probably copied the stylesheet code, which was meant for a horizontal scrollbar and tried to use it for a vertical one.

    where you use height, you should use width instead and vice versa.



  • thanks Eddy, Now I understand. You're right in all.


  • Moderators

    You're welcome!

    Could you please edit your title and add [solved] in front of it?


Log in to reply
 

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