Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/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:

    Python:
    @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