我使用的是Qt 5.3.0.当我在QPushButton的选中状态上应用一些背景颜色时,按钮将在选中时用灰色点(我想要的背景颜色)填充.
这是一个很小的测试程序(使用qtcreator,但它也可以通过编码完成):
1,创建一个qt应用程序
2,拖入QPushButton,将其设置为平坦且可检查
3,在w.show()之前添加这些行
w.setStyleSheet("\ QPushButton { \ color:white; \ } \ QPushButton:checked{\ background-color: rgb(80,80,80);\ }\ QPushButton:hover{ \ background-color: grey; \ border-style: outset; \ } \ ");
4,运行应用程序并检查按钮
你会看到按钮变成了点缀但是我需要选中的按钮是纯色的rgb(80,80).
我错过了什么?
解决方法
原文地址:https://www.jb51.cc/css/214874.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。