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. [SOLVED] QCheckBox background color?
QtWS25 Last Chance

[SOLVED] QCheckBox background color?

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 13.1k Views
  • 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.
  • S Offline
    S Offline
    Sam
    wrote on last edited by
    #1

    How to change the background color of the box/frame (default white ) in QCheckBox. I tried to use stylesheets by setting the background-color but it changes the label's background color. Am I missing something ?

    Thanks,

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      AFAIK that's not possible.
      But you can replace the whole checkbox (not it's label) with an image of your choice...

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        qxoz
        wrote on last edited by
        #3

        Hi Sam!
        Look at this "DarkStyle":http://qt-project.org/forums/viewthread/27978/#126305
        maybe you can take some useful things.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Sam
          wrote on last edited by
          #4

          -Thanks qxoz, but there is no specification for changing the background-color of the checkbox. I think I have to change the image as suggested by raven-worx.-

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Sam
            wrote on last edited by
            #5

            @qxoz

            Thanks the image shows the checkbox, but I have no idea about the implementation. I am still searching for a solution.

            Regards
            Sam

            1 Reply Last reply
            0
            • raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by
              #6

              ah..it seems it is possible via stylesheet after all:
              @
              QCheckBox::indicator
              {
              background-color: #FFFFFF;
              }
              @

              It may be possible that you also have to style the border to take the background-color effect.

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              1 Reply Last reply
              2
              • S Offline
                S Offline
                Sam
                wrote on last edited by
                #7

                Yep played with stylesheets thats the only way i got.

                Thanks.

                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