参考代码如下:
pixmap.load(":/new/prefix1/淳中切图/未选中-3.png");
pixmap = pixmap.scaled(QSize(125 / m_percentW,30 / m_percentH),Qt::KeepAspectRatio);
m_sceneBtnGroup->setFixedSize(pixmap.size());
bit = pixmap.mask();
m_sceneBtnGroup->setMask(bit);
m_sceneBtnGroup->setStyleSheet("QPushButton{border-image: url(:/new/prefix1/淳中切图/未选中-3.png);"
"border:none;font-size: 31px;font-family: Microsoft YaHei;"
"font-weight: 400;color: #FFFFFF;line-height: 18px;}"
"QPushButton:checked{border-image: url(:/new/prefix1/淳中切图/选中-3.png);"
"font-size: 31px;font-family: Microsoft YaHei;"
"font-weight: 400;color: rgba(255, 255, 255, 0.8);line-height: 18px;}");