[PyQt] Segfault when activating items in a view, more info

Andreas Pakulat apaku at gmx.de
Mon Aug 9 12:05:46 BST 2010


On 09.08.10 12:51:48, peter at lohmanders.se wrote:
> Hi Andreas!
> 
> Yes, the model isn't properly implemented, still not sure why I'm getting a 
> segfault rather than infinite loop. Might be some internal stack overflow?
> 
> Anyway, thanks for your reply! I didn't even consider it would would try 
> using children indices since a table model doesn't/shouldn't have them.

Well, the treeview doesn't know its a table model. (in fact none of the
standard views cares about the specific subclass of QAbstractItemView its
dealing with)

The QAbstractItemView API is the contract between model and view and hence
its whats being used by the views. The QAbstractTableModel is just a
convenience class with some defaults for some of the contract-API from
QAbstractItemView already implemented. You still have to implement the
data,rowCount and columnCount according to the QAbstractItemView contract.
And that means returning a proper rowcount depending on the given index.

Andreas

-- 
You will lose your present job and have to become a door to door mayonnaise
salesman.


More information about the PyQt mailing list