Stylesheet for QRadioButton



  • 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.


  • Moderators

    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)

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.