PDA

View Full Version : Get an Index inside a TableView[SOLVED]



jano_alex_es
15th May 2009, 07:56
Hi,

I need to go through a TableView, obtain some data... and since now I did something like:



QAbstractItemModel* tableModel;
QModelIndex index;

tableModel = my_TableView->model();
index = my_TableView->currentIndex();

for(int i = 0; i < tableModel->rowCount(); ++i)
{
iIDList->append(tableModel->data(index.sibling(i, 4)).toInt());
}

tableModel = 0;


But now I don't have any index selected... so "currentIndex()" sends null.

Any idea how I can solve it? thanks!

jano_alex_es
15th May 2009, 08:10
Sorry, my bad... hours working around this problem and once I open a thread in the forum, I found the answer :S

Anyway, the solution was impossible to be easier, something as simple as:
index = tableModel->index(0, 0);