[PyQt] Bug in QAbstractItemModel::createIndex()?

Phil Thompson phil at riverbankcomputing.co.uk
Thu Apr 5 11:28:23 BST 2007


On Thursday 05 April 2007 1:01 am, Andreas Pakulat wrote:
> Hi,
>
> the latest eric4 snapshots seem to not work wrt model/view stuff, first
> I thought its because they create model indexes using
>
> createIndex(row,col,item)
>
> where item is an instance of a class, however when getting an index the
> model always asks it for its internalId() and not the internalPointer().
> So I changed it to
>
> createIndex(row,col,id(item))
>
> which should work, but the created indices don't have a proper
> internalId, its always some negative number.
>
> The attached example is the simepltreemodel modified to use internalId
> instead of internalPointer and shows the same problem.

Works fine for me - once the obvious typo is fixed.

Phil


More information about the PyQt mailing list