On Thursday 05 April 2007 1:12 pm, Andreas Pakulat wrote: > On 05.04.07 12:14:01, Phil Thompson wrote: > > On Thursday 05 April 2007 11:44 am, Andreas Pakulat wrote: > > > On 05.04.07 11:28:23, Phil Thompson wrote: > > > > 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. > > > > > > Would you mind sharing your knowledge with me? I can't find a typo in > > > the code I changed. > > > > The spelling of itemdict on line 120 - the line that generates all those > > exception messages. Maybe you didn't attach the version you intended to. > > Uhm, right, overlooked that one. > But the problem still persists, what I see here is: > KeyError: -1212033192L > Traceback (most recent call last): > File "simpletreemodel.py", line 88, in data > item = self.itemdict[index.internalId()] > KeyError: -1212033192L > Traceback (most recent call last): > File "simpletreemodel.py", line 88, in data > item = self.itemdict[index.internalId()] > KeyError: -1212033096L > > And that is with the latest snapshot. I have absolutely no idea how that > can happen and so far it seems I'm the only one seeing this.
Jeremy Sanders posted about a similar problem last August. Attached is his test script. He was getting the same values on a 32 bit system but different values on a 64 bit system. You getting different values would explain the behaviour you are seeing. However I get the same values on both 32 and 64 bit systems - but none of my values go negative. Certainly internalPointer() should be used in preference to internalId(). Phil
bug.py
Description: application/python
_______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
