Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Stylesheet for QRadioButton

Stylesheet for QRadioButton

Scheduled Pinned Locked Moved C++ Gurus
2 Posts 2 Posters 2.3k 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.
  • M Offline
    M Offline
    Milica
    wrote on last edited by
    #1

    I want to add a stylesheet to a QRadiobutton. Want that black dot to be some other color, example red.
    But if i try this:

    QRadioButton::indicator::checked
    {
    border:1px solid black;
    border-radius: 8px;
    background-color: red;
    };

    the white space between border and dot disapears.

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by Chris Kawa
      #2

      The black dot is an image so you can't change its color. What you have above has replaced the image with a solid color.

      If you want a red dot you need to provide an image with it and use background-image.
      Another way is to provide a clever radial gradient that will draw the dot as background, e.g.

      background: qradialgradient(cx:0, cy:0, radius: 1, fx:1, fy:1, stop:0.25 red, stop:0.3 white)
      
      1 Reply Last reply
      1

      • Login

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