Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 QVBoxLayout 小部件,它有几行,每行包含几个按钮。在一个事件中,我想通过更改其背景来突出显示其中一行。我尝试了许多不同的方法,但都没有奏效。实现这一目标的好方法是什么?
您可以在所需行中的小部件上执行以下操作,将黑色替换为您希望拥有的颜色:
myWidget.setStyleSheet("background-color: black;");