Artmetic Changing stylesheet of indicator QRadioButton

Changing stylesheet of indicator QRadioButton

If you want to improve your push button with a different colour stylesheet, you can use the following code in Qt:

QRadioButton{
color: #184880;
font-weight: bold;
}
QRadioButton::indicator{
color: #184880;
width: 10px;
height: 10px;
background: white;
border-width: 2px;
border-style: solid;
border-radius: 7px;
}

QRadioButton::indicator:checked
{
color: black;
background: black;
border-width: 2px;
border-style: solid;
border-radius: 7px;
border-color: white;
}

Depending on what size you want to have, you can modify both width and height, but you must remember to fit your border-radius.

Effect:

Zrzut ekranu z 2014-07-13 00:20:09

You can also adjust the colour of indicator, whether it is checked or unchecked. If you want to use different „checked” and „unchecked” styles, you can use some images. You must remember to add images of „check” or „uncheck” to your resources files.

QRadioButton {
spacing: 12px;
color: white;
background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 1,
stop: 0 #905a6c, stop: 1 2f0b17); border-style: outset;
border-width: 2px;
color: white;
border: 3px solid white;
border-radius: 3px;\n
}

QRadioButton::indicator {
width: 38px;
height: 38px;
}

QRadioButton::indicator:unchecked {
image: url(:/CheckBox/unchecked.png);
margin-left: 8px;
margin-top: 5px;
margin-bottom: 5px;
}

QRadioButton::indicator:checked {
image: url(:/CheckBox/checked.png);
margin-left: 8px;
margin-top: 5px;
margin-bottom: 5px;
}


Effect:

Zrzut ekranu z 2014-07-13 00:19:45

Leave a Reply

Twój adres email nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *

Witryna wykorzystuje Akismet, aby ograniczyć spam. Dowiedz się więcej jak przetwarzane są dane komentarzy.