@Christian-Ehrlicher
Thanks for the suggestion. Still I consider a custom delegate an overkill for such simple functionality, as my table is fairly simple and it will not contain more than a dozen rows.
@anil_arise
Thank you for the code. I will try that too.
In the meantime, I found a solution. The problem and the confusion was that when a radio button (or checkbox) is checked, two toggled signals are emitted -one for the radio button actually clicked and one for the previously checked radio button which changes to unchecked, as the buttons are set to autoExclusive. So, I worked with the model indexes and got the result I wanted (note that in the end I opted for a QCheckBox):
void ServiceDialog::setActiveModel()
{
for (auto row = 0; row < ui->myTable->rowCount(); row++) {
QCheckBox *box = qobject_cast<QCheckBox*>(ui->myTable->cellWidget(row,5));
if (box && box->isChecked()) {
ui->myTable->setCurrentIndex(ui->myTable->model()->index(row,0));
ui->myTable->selectRow(ui->myTable->currentIndex().row());
theStringIwant = ui->myTable->item(ui->myTable->currentIndex().row(),0)->text();
break;
}
}
...
}