Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt QPushButton checked Style
Qt 6.11 is out! See what's new in the release blog

Qt QPushButton checked Style

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 9.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    needhelp_gh
    wrote on last edited by
    #1

    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!!


    http://abstrusegoose.com/432

    1 Reply Last reply
    0
    • R Offline
      R Offline
      rschaub
      wrote on last edited by
      #2

      there's a } missing, invalidating your stylesheet.

      1 Reply Last reply
      0
      • N Offline
        N Offline
        needhelp_gh
        wrote on last edited by
        #3

        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.


        http://abstrusegoose.com/432

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved