0

I am trying to diable the click on radio buttons from the user - so that they only can be changed from the code. I have tried with this connection without any effect (it gets triggered through):

connect(ui->radioButton, &QRadioButton::clicked, [this]() {
        return true;
    });

Any suggestions?

7heViking
  • 7,137
  • 11
  • 50
  • 94
  • FYI: [SO: How to make QRadioButton to “read-only”?](https://stackoverflow.com/q/35651905/7478597) – Scheff's Cat Feb 18 '20 at 11:56
  • Another option (I found in qtforum.de - German): You may use a label with two pixmaps for checked/unchecked state. For convenience, you could even derive your own class from `QLabel` to automate this. – Scheff's Cat Feb 18 '20 at 12:00
  • 1
    In our S/W, we derived the `QCheckBox`/`QRadioButton` which just reset the value in the `clicked()` handlers to the previous state if editing is disabled. Of course, a separate member variable is used to store this state which may appear redundant but makes it robust and reliable. – Scheff's Cat Feb 18 '20 at 12:03

0 Answers0