1、多选按钮
ui->checkBox->setStyleSheet("QCheckBox {"
"spacing: 5px;"
"font-size: 14px;"
"color: rgb(24, 220, 88);}"
"QCheckBox::indicator { "
"width: 16px;"
"height: 16px;}"
// 未选中时正常状态
"QCheckBox::indicator::unchecked {"
"image: url(:/1.png);}"
// 未选中时,鼠标悬停时的状态
"QCheckBox::indicator:unchecked:hover {"
"image: url(:/2.png);}"
//未选中时,按下时的状态
"QCheckBox::indicator:unchecked:pressed {"
"image: url(:/3.png);}"
// 选中时的状态
"QCheckBox::indicator::checked {"
"image: url(:/4.png);}"
// 选中时,鼠标悬停状态
"QCheckBox::indicator:checked:hover {"
"image: url(:/5.png);}"
// 选中时,鼠标下按时的状态
"QCheckBox::indicator:checked:pressed {"
"image: url(:/6.png);}"
);
单选按钮将QCheckBox替换为QRadioButton
来源:CSDN
作者:大树学长
链接:https://blog.csdn.net/bigtree_mfc/article/details/103582863