QT中改变QRadioButton选中按钮的颜色

要想改变QRadioButton选中按钮(圆点)的颜色,可以使用Qt 中的style sheets来进行设置。

官方手册中有对style sheets的介绍。

链接为:http://doc.qt.io/archives/qt-4.8/stylesheet.html

那怎样设置呢?

在官方的文档中也有说明

链接:http://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qcheckbox

//定义indicator子控件
QRadioButton::indicator {
    width: 13px;
    height: 13px;
}

//没有被选中时
QRadioButton::indicator::unchecked {
    image: url(:/images/radiobutton_unchecked.png);
}

//选中时鼠标在上面悬停状态
QRadioButton::indicator:unchecked:hover {
    image: url(:/images/radiobutton_unchecked_hover.png);
}

//未选中时鼠标点击下按时状态
QRadioButton::indicator:unchecked:pressed {
    image: url(:/images/radiobutton_unchecked_pressed.png);
}

//被选中时
QRadioButton::indicator::checked {
  • 11
    点赞
  • 54
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值