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. Check QPushButton Color.
Qt 6.11 is out! See what's new in the release blog

Check QPushButton Color.

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 673 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.
  • P Offline
    P Offline
    Phamy1289
    wrote on last edited by
    #1

    Is there a way, when a button is clicked, to switch between to color gradients?

    For example, when I click on transmitter 1 it will change to color of transmitter 5 and vise versa when I click it again.
    d3e6706f-068e-4e27-98af-cfe3dafc4369-image.png

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mchinand
      wrote on last edited by
      #2

      This is probably best handled with style sheets by adding a :checked state customization (like the :pressed state here). Also, you have to make the buttons checkable. https://doc.qt.io/qt-5/stylesheet-examples.html#style-sheet-usage

      1 Reply Last reply
      1
      • JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by
        #3

        yes. Change its stylesheet.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          Phamy1289
          wrote on last edited by
          #4

          I didn't realize I had to make it checkable. I also added the :checked state. Thanks everyone, that worked.

          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