PDA

View Full Version : Wrong index row required in QAbstractItemModel implementation



faraslacks
10th September 2009, 10:43
I have complex structure of data and model to access to it.


Item (single value)
|
+-Item (single value)
|
+-Factory (single value)
| |
| +-Table (rows, columns)
|
+-Factory (single value)
|
+-Table (rows, columns)

Elements of data stored in classes inherited from BaseItem class (in QModelIndex::internalPointer). To understand which implementation of BaseItem I have in current QModelIndex I use dynamic_cast<class name>.

I return correct rowCount and columnCount for each of structure elements, but on "Factory level" row of required row is -1 (in index method). Why view (I use QTreeView) asked for index of row -1?

P.S. Code is in attachment.