Setting background color for QCheckBox::indicator resets all other styling



  • I have a QCheckbox appearing on a form with a non-white background, but want the indicator to appear with a white background. My first guess was that this could be achieved inside my application stylesheet by adding:

    QCheckBox::indicator {
    background-color: white;
    }

    However, this completely ruins the tickbox: the depth-effect is gone, and also no checkmark appears anymore when the checkbox is selected.

    What am I doing wrong?


  • Lifetime Qt Champion

    Hi,

    Nothing really wrong, QWidget using style sheets are rendered by a special style. With style sheets you can customize things that might not be done with the native style.


Log in to reply
 

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