本文共 605 字,大约阅读时间需要 2 分钟。
为什么失效了???
经过1个小时之久的研究终于发现了问题!!!即背景颜色background-image与图标的特效背景颜色冲突了。
样式表设置:
*{ background-image:url(":/skin/21"); } QPushButton#addid{ border-style:outset; font: 75 18pt “Times New Roman”; font-weight:bold; color:rgb(255, 170, 0); background-color:rgba(225, 225, 225, 0); } }QPushButton#addid:hover{
background-color:rgba(225, 225, 225,200); } }QPushButton#addid:pressed{
background-color:rgba(225, 225, 225, 200); } }所以我把
*{ background-image:url(":/skin/21"); } 删掉了取而代之的使用QPainter设置背景的方式
即
void Widget::paintEvent(QPaintEvent *){
QPainter p; p.begin(this); p.drawPixmap(rect(),QPixmap(":/skin/21")); }转载地址:http://fmzhz.baihongyu.com/