PDA

View Full Version : Display current row and columv value



sosanjay
22nd October 2009, 13:28
I am using Qt TableWidgets and I am trying to fetch the current row and column whatever is selected by user.



I am using cellClicked SIGNAL of QTableWidget





connect(ui->tableWidget, SIGNAL(cellClicked(int,int)), this, SLOT(removeSR(int r,int c)));



Through this function removeSR(int r,int c) I am trying to fetch the current row and column but it does not display the value of current row and column.


Please send me the snippets of the code or any another way if possible.

Lykurg
22nd October 2009, 14:01
but it does not display the value of current row and column.
This is because your connection syntax is wrong! Don't put the names of your arguments there:

connect(ui->tableWidget, SIGNAL(cellClicked(int,int)), this, SLOT(removeSR(int,int)));

((And removeSR must be declared as a slot and you have to use Q_OBJECT))

sosanjay
24th October 2009, 09:16
Thanks, Its working fine.

when I Insert data in the table first time it shows from starting but next time it append from the last.

Can it possible that current data will always show from the starting of the table.

Like :-





when I send data 1,2,3

it shows
1
2
3

and when I send data second time 4,5 it shows

1
2
3
4
5

But I need to show in this format where 5 is the latest data

5
4
3
2
1