选中和取消选中 Qt 上的 QRadioButton 颜色更改颜色、Qt、QRadioButton

由网友(得知你过得不好我便安心了)分享简介:我正在尝试将选中和取消选中的单选按钮的颜色更改为QtStylesheet: 仔细.它描述了您所需要的一切.它甚至几乎描述你的情况,唯一的区别是图像而不是颜色.您的案例的样式表如下:QRadioButton {背景颜色:灰色;白颜色;}QRadioButton::indicator {宽度:10px;高度:10px;边框...

我正在尝试将选中和取消选中的单选按钮的颜色更改为QtStylesheet: 仔细.它描述了您所需要的一切.它甚至几乎描述你的情况,唯一的区别是图像而不是颜色.

您的案例的样式表如下:

QRadioButton {背景颜色:灰色;白颜色;}QRadioButton::indicator {宽度:10px;高度:10px;边框半径:7px;}QRadioButton::indicator:checked {背景颜色:红色;边框:2px 纯白色;}QRadioButton::indicator:unchecked {背景颜色:黑色;边框:2px 纯白色;}
QT里面用treeview显示的目录和文件选中后怎么打开

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 could I change it color and without loading Image and change border color or styling radiobutton

the requirement is attached in the Image :

解决方案

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;
}

阅读全文

相关推荐

最新文章