Important: Please read the Qt Code of Conduct -

Qt QPushButton checked Style

  • Hi,

    I'm trying to change the style of a QPushButton when it is checked. I tried this:

    @widget.pushButton.setStyleSheet("QPushButton#pushButton:checked {color: black; background-color: green;")@

    But it doesn't seem to be working.

    Please help! Thanks!!

  • there's a } missing, invalidating your stylesheet.

  • Thanks, Good eye! I also noticed that I was referencing the wrong button.

    It is giving that style when the button is unchecked, not checked.

Log in to reply