PDA

View Full Version : accessing table elements in Qt



awanish_jmi
8th July 2008, 17:48
hi frnds...
i'm new to Qt...presently i m deveoping a GUI in which i need to handle table elements...i hav included table widget...now d user should be able to fill the table elements...but i m unable to access d elements(Row,Coloumn)...means how table elements are reffered in Qt...
suppose i want to print the value of (3rd row,2nd coloumn)...so what would be d syntax...
how can i proceed...??

plz help...
looking for ur suggestions....>>>
thanks...

jpn
8th July 2008, 17:52
Please use the great Qt reference documentation (http://doc.trolltech.com/4.4/qtablewidget.html#item):

QTableWidgetItem* item = tableWidget->item(row, column);

awanish_jmi
8th July 2008, 19:04
thanks...

but can we store these items in an array for futher processing...suppose my table has 10 rows and 1 coloumn...d items in the cells are 0,1......9. the very first thing is that how we set these items into cells...n then how to store these elements into an array to print the items...

as i said earlier i'm new to Qt so plz give each n every steps in more elaborate manner...

thanks again...

wysota
8th July 2008, 19:53
It would really be advised if you read the documentation you were given. Then you should take a look at provided examples. Otherwise you'll be asking about everything on every step. At some point you will have to read some of the docs, so it's better to do it sooner than later.

awanish_jmi
21st July 2008, 20:18
thanks for ur suggestions...
but i'm using Qt3 on Linux and there is no class QTableWidgetItem in Qt3...
so how can i proceed....???

jacek
28th July 2008, 12:51
but i'm using Qt3 on Linux and there is no class QTableWidgetItem in Qt3...
But there's QTableItem.