特殊样式按钮,譬如五角星按钮:
1、实现方法
this->setWindowFlags(Qt::FramelessWindowHint);
this->setAttribute(Qt::WA_TranslucentBackground);//very important,有效去锯齿
setStyleSheet("QPushButton{border-image: url(:/111.png);}");//这里要用border-image,background-image不行的!!!
2、效果
注明:特殊样式按钮,不需要使用Qt设置掩码区域的接口;
GitHub源代码链接:https://github.com/wentaosong1993/QtLianXi/commit/d2d85cf9755ce47b35f7622e268baed84fec69c8