I'd like to iterate through all the GUI Checkboxes via an array... for i = 0 ; i < 9; i++ ck[i].setCheckState(Checked) Is it possible to drag a Checkbox into the editor and tell it that this is ck 5 of 10? If not, and we must define the name as ck0..ck9... is there a way to programmatically access a checkbox by dynamically building the variable name ("ck"+"0").setChecked? Alternatively, creating an array that at run-time, initializes with the address of the Checkbox elements.. ui->setupUi(this); // Setup UI from the .ui file QCheckBox* ck[10]; ck[0] = findChild("ck0"); ... ck[9] = findChild("ck9"); for (auto checkBox : ck) { checkBox->setChecked(true);
Thanks for watching my videos. Yes you can get the all checkbox recursively of entire application and set the Checkbox status and other property also. Follow The Code :: QList AllCheckBoxes = this->findChildren(); // To Get The Checkbox of of parent container. for (int i = 0; i < AllCheckBoxes.size(); i++) { qDebug() objectName(); // Get Your Object Name AllCheckBoxes.at(i)->setChecked(true); // Set Property }