QRadioButton color change on Selected and deselected Qt

后端 未结 3 765
-上瘾入骨i
-上瘾入骨i 2021-01-20 12:09

i am trying to change the color of radiobutton on selected and deselected as QtStylesheet :Qt Stylesheet

but In this link it only refer to Loading a Image but how cou

3条回答
  •  温柔的废话
    2021-01-20 12:44

    Read documentation carefully. It describes all you need. It even almost described your case, the only difference is images instead of colours.

    Style sheet for your case is like this:

    QRadioButton {
        background-color:       gray;
        color:                  white;
    }
    
    QRadioButton::indicator {
        width:                  10px;
        height:                 10px;
        border-radius:          7px;
    }
    
    QRadioButton::indicator:checked {
        background-color:       red;
        border:                 2px solid white;
    }
    
    QRadioButton::indicator:unchecked {
        background-color:       black;
        border:                 2px solid white;
    }
    

提交回复
热议问题