PDA

View Full Version : QTableView row/column count [SOLVED]



jano_alex_es
14th May 2009, 10:52
Hi,

I'd like to know how many rows/columns my qTableView has.

I was trying something like:



QAbstractItemModel* tableModel= my_table->model();
QModelIndex index = my_table->currentIndex();

int iRows = tableModel->rowCount(index);


But it doesn't work

How I can do it? thanks!

spirit
14th May 2009, 11:02
try this


QAbstractItemModel* tableModel= my_table->model();
int iRows = tableModel->rowCount();
int iCols = tableModel->columCount();

e.g. don't specify a parent.

jano_alex_es
14th May 2009, 11:10
hehehe, it was so easy... :P

don't know why, I was obfuscated with its parent.

thanks!