【发布时间】:2014-07-13 01:13:39
【问题描述】:
我使用的是 Qt 5.3.0。当我在 QPushButton 的选中状态上应用一些背景颜色时,当它被选中时,该按钮将填充有灰点(在我想要的背景颜色之上)。
这是一个小型测试程序(使用 qtcreator,但也可以通过编码完成): 1、创建一个qt应用 2、拖入一个QPushButton,设置为flat and checkable 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, 80)。 我错过了什么吗?
【问题讨论】:
标签: css windows qt stylesheet qpushbutton