Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QCheckBox QSS problem



  • Hi all,

    so I have QCheckBox on QDialog like this
    5eb1265f-bfee-42d4-ae05-2fb61342a5e8-image.png
    There is has following QSS style:

    QDialog {
      background-color: #124A61;
      color: #e1e1e1;
    }
    
    QDialog#EditUserDialog QCheckBox {
      background-color: #124A61;
      color: white;
      border-color: white;
    }
    

    but I need the border of square rectangle make white too. So I've tried

    QDialog#EditUserDialog QCheckBox::indicator {
      border: 1px solid white;
      background-color: none;
      color: white;
    }
    

    as result of
    587b62a8-833b-4c04-bd73-f4ab0e230823-image.png
    Seems all be ok, but when I try to check control by clicking mouse the check indicator is not visible and nothing happened. (May be check indicator under background of rectangle?).

    How can I make this correct? I need like this
    19cc0f71-67f8-40fc-b1c2-57cd934e86c0-image.png



  • @Alexey-Serebryakov said in QCheckBox QSS problem:

    QCheckBox::indicator {
    border: 1px solid white;
    background-color: none;
    color: white;
    }

    When you set this, you need to specify the appearance further, otherwise the check mark will also have color none.

    Try to change settings of QCheckBox::indicator::checked.

    https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qcheckbox


Log in to reply