我已经尝试过使用disabled
and !enabled
但它不起作用。
这是我的 QSS 代码:
QPushButton {
background-color:#44c767;
border-radius:5px;
border:1px solid #18ab29;
color:#ffffff;
font-family:arial;
font-size:15px;
font-weight:bold;
text-decoration:none;
padding-right:10px;
outline: 0;
}
QPushButton:hover:!pressed {
background-color:#54d777;
}
QPushButton: pressed {
background-color:#30b252;
}
QPushButton: disabled {
background-color:#ff0000;
}
QPushButton: !enabled {
background-color:#ff0000;
}
该文档引用了一个disabled http://qt-project.org/doc/qt-5/stylesheet-reference.html#disabled-ps伪状态,但没有提供有关它的更多信息。
Edit
我使用的是QT5.3
删除冒号后面的所有空格(真的全部 - 因为它会使进一步的 css 文本无效),它将起作用:
QPushButton:disabled {
background-color:#ff0000;
}
事实上,两者disabled
and !enabled
works.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)