<br><br><div class="gmail_quote">On Wed, Jun 3, 2009 at 10:23 AM, "V. Armando Solé" <span dir="ltr"><<a href="mailto:sole@esrf.fr">sole@esrf.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Darren Dale wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Armando,<div class="im"><br>
<br>
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.<br>
<br>
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.<br>
<br>
By the way, is your windows machine 32 or 64 bit?<br>
</div></blockquote>
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.<br>
<br>
By the way, does the posted code behaves properly on your system? Sometimes fails even at 64 bit.</blockquote><div><br>When I run this version of your script, the two identifiers are never the same:<br></div><div><br>import PyQt4.Qt as qt<br>
<br>import random<br><br>class Model(qt.QAbstractItemModel):<br> def index(self, row, column, parent):<br> a=[random.random()]<br> index = self.createIndex(row, column, id(a))<br> print "Next two values should be the same"<br>
print "indexInternalId = ", index.internalId()<br> print "id(a) = ", id(a)<br> return index<br><br>if __name__ == "__main__":<br> app = qt.QApplication([])<br> w = Model()<br>
w.index(0,0,None) <br></div></div><br><br>