I have several radio buttons in a group, is there a way to get the index of the currently checked item?
Right now I use this code:
int getCheckedRadioButton(QWidget *w)
{
int ii = 0;
foreach (QRadioButton *button, w->findChildren<QRadioButton*>()) {
if (button->isChecked()) {
return ii;
}
ii++;
}
return -1;
}
This works well enough, but maybe there is a standard Qt function or way to do it?