How to change QPushButton text and background color

前端 未结 3 487
甜味超标
甜味超标 2020-12-06 10:07

I am using following code to connect QMenu to QPushButton. When button is clicked a pull-down menu with multiple sub-menu\'s items is shown.

<
3条回答
  •  清歌不尽
    2020-12-06 10:26

    For those who still want to change color of button with the instruction

    button.setStyleSheet('QPushButton {background-color: #A3C1DA}')
    

    and not able to do so, just modify the above instruction to

    button.setStyleSheet('QPushButton {background-color: #A3C1DA; border:  none}')
    

    And it will change the button color, so the trick is to remove the border

提交回复
热议问题