如何更改按钮的焦点颜色,如下所示:
我还更改了按钮的背景颜色和调色板,但仍然没有发生任何变化。
使用样式表:
QPushButton:focus:pressed{ background-color: some_colour; } QPushButton:focus{ background-color: some_other_colour; }
您可以使用 Qt Creator 将样式添加到按钮,或者通过在按钮上调用
setStyleSheet("...")