设置选中后的qcheckbox背景色和图形颜色
时间: 2024-03-13 17:45:36 浏览: 190
您可以使用CSS来设置QCheckBox选中时的背景色和图形颜色。以下是一个示例:
QCheckBox::indicator:checked {
background-color: #007acc;
border: 1px solid #007acc;
}
QCheckBox::indicator:checked:disabled {
background-color: #c8c8c8;
border: 1px solid #c8c8c8;
}
QCheckBox::indicator:unchecked {
background-color: transparent;
border: 1px solid #c8c8c8;
}
QCheckBox::indicator:unchecked:disabled {
background-color: transparent;
border: 1px solid #c8c8c8;
}
其中,QCheckBox::indicator:checked
设置了选中时的背景色和边框颜色,QCheckBox::indicator:checked:disabled
设置了选中且不可用时的背景色和边框颜色,QCheckBox::indicator:unchecked
设置了未选中时的边框颜色,QCheckBox::indicator:unchecked:disabled
设置了未选中且不可用时的边框颜色。
您可以根据需要自定义这些颜色。
相关推荐







