2

Like seen on the picture, I have 96 pushbuttons initially green. Once clicked on a button ( toggled(bool) ) it becomes red.

What I want to do is to disable all red buttons once I click on the OK button.

How can I do that ?

If the OK button closes this window, what should I do so that the modifications ( disabled buttons ) are saved once I open the window again!

enter image description here

ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97

1 Answers1

1

in qt togglebuttons are jut norlmal buttons, those inherit the qAbstractbutton

https://doc.qt.io/archives/qt-4.8/qabstractbutton.html#checked-prop

there you can use the bool isChecked() method:

This property holds whether the button is checked.

Only checkable buttons can be checked. By default, the button is unchecked.

so I imagine, you have the grid in some kind of array you can browser in a for loop...

so you can do:

for(...)
{
    ui->x->setEnabled(!ui->x->isChecked());    
}
ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97