View Full Version : How to get the row number of checked radio button in QTableWidget

26th April 2012, 11:26
I'm using a QTableWidget which has 62 rows and 5 columns. I have a QRadioButton on 1st column of each row.

for(int x = 0; x < 62; x++)
rbDeviceSelect[x] = new QRadioButton();
oDevStatePanel->setCellWidget(x, 0, rbDeviceSelect[x]);

I need to get the row number of the checked QRadioButton, from which I have to get the text from the 2nd column of the same row.
How can I do this ?

Thank you.

26th April 2012, 11:36
Use QTableWidget::indexFromItem if you know the item. This method return index which is QModelIndex, and use QModelIndex::row