Hi

I'm trying to show a bool value with a QCheckBox, that the user shouldn't be able to change, but without changing the appearance of the QCheckBox.

This is what I've got so far:

Qt Code:
  1. checkBox->setEnabled(false);
  2. QPalette palette(checkBox->palette());
  3. palette.setColor(QPalette::Disabled, QPalette::WindowText, QColor(Qt::black));
  4. checkBox->setPalette(palette);
To copy to clipboard, switch view to plain text mode 

That changes the text color back to black, but the checked indicator still is grey.
I tried to change it with a style-sheet:

Qt Code:
  1. checkBox->setStyleSheet("::indicator { border-color: black; }");
To copy to clipboard, switch view to plain text mode 
...with that the indicator isn't visible.

Qt Code:
  1. checkBox->setStyleSheet("::indicator { width: 12px; height: 12px; border-width: 1px; border-style: solid; border-color: black; }");
To copy to clipboard, switch view to plain text mode 
... with that it is, but it just looks weird, plus the check doesn't show.

There has to be a simpler way.
I already thought about just connecting the QCheckBox toggled(bool checked) signal to a slot connected to:

Qt Code:
  1. void::myClass checkBoxToggled(bool checked)
  2. {
  3. checkbox->setChecked(whatever I need);
  4. }
To copy to clipboard, switch view to plain text mode 

..or something like that.

Any suggestions?