PDA

View Full Version : How to identify working row in QTableView



ronak.vashi
9th December 2010, 09:23
Hi All,

There is a QTableView displayed for taking input from user on QWidgetalong with few buttons and drop-downs. There is a button to add rows in QTableView

QTableView is having 7 columns out of which one is QDateEdit(Col# 1), one is QComboBox(Col#4) and rest are QLineEdit. By default one row is displayed with all widgets set at their respective cells.

My Requirment is :

I want to disable QLineEdit at cell (x,2) if in QComboBox at (x,4) value "xyz" is selected.

My Concern is :

I am not able to identify user has clicked QComboBox of which row.
Is there any in-buit function to get row number user is currently working ?


Please help !!! :)

boudie
9th December 2010, 09:53
You can get the row number from the ModelIndex.

But maybe you should take a look at the use of QItemDelegate to fine-tune the behaviour of a QTableView.
It's really worth the trouble of learning the concept... ;)

ronak.vashi
9th December 2010, 10:57
You can get the row number from the ModelIndex.

But maybe you should take a look at the use of QItemDelegate to fine-tune the behaviour of a QTableView.
It's really worth the trouble of learning the concept... ;)

Can you paste few lines of code.....??? I tried using QModelIndex but didn't succeed.

I have connected currentIndexChanged() signal to my own function while setting up QComboBox, but in that case also not able to identify which row's combo box is clicked.