On Wed, Jun 3, 2009 at 10:37 AM, Darren Dale <[email protected]> wrote:
> > > On Wed, Jun 3, 2009 at 10:23 AM, "V. Armando Solé" <[email protected]> wrote: > >> Darren Dale wrote: >> >>> Hi Armando, >>> >>> Relatedly, I think there is a small problem with the PyQt4 documentation >>> for the overloaded QAbstractItemModel.createIndex method. It looks like Qt's >>> documentation for passing a pointer is being presented in PyQt4's method for >>> passing an identifier, and PyQt's pointer method documentation is empty. >>> >>> When I first read PyQt's documentation for this method, there was nothing >>> to indicate that the id passed to createIndex should end up as the index's >>> internalId(), so I wrote a workaround. But now that I read Qt-4.5's >>> documenation for this method, it seems clear that these identifiers should >>> be equal. >>> >>> By the way, is your windows machine 32 or 64 bit? >>> >> 32-bit. Anyways there is something weird. I have tried masking id and >> internalId with the operation & 0xFFFFFFFF in order to generate the same >> values. Nevertheless, the self._idMap dictionnary keeps growing. I always >> end up with an infinite tree in linux-32 and not in linux-64. >> >> By the way, does the posted code behaves properly on your system? >> Sometimes fails even at 64 bit. > > > When I run this version of your script, the two identifiers are never the > same: > > import PyQt4.Qt as qt > > import random > > class Model(qt.QAbstractItemModel): > def index(self, row, column, parent): > a=[random.random()] > index = self.createIndex(row, column, id(a)) > print "Next two values should be the same" > print "indexInternalId = ", index.internalId() > print "id(a) = ", id(a) > return index > > if __name__ == "__main__": > app = qt.QApplication([]) > w = Model() > w.index(0,0,None) > I should have noted, I'm testing on 64-bit linux.
_______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
