<div class="gmail_quote">On Wed, Jun 3, 2009 at 10:37 AM, Darren Dale <span dir="ltr"><<a href="mailto:dsdale24@gmail.com">dsdale24@gmail.com</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;">
<br><br><div class="gmail_quote"><div><div></div><div class="h5">On Wed, Jun 3, 2009 at 10:23 AM, "V. Armando Solé" <span dir="ltr"><<a href="mailto:sole@esrf.fr" target="_blank">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><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></div><div><br>When I run this version of your script, the two identifiers are never the same:<br></div>
<div><div class="im"><br>import PyQt4.Qt as qt<br>
<br></div>import random<div class="im"><br><br>class Model(qt.QAbstractItemModel):<br> def index(self, row, column, parent):<br></div> a=[random.random()]<div class="im"><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></div></blockquote><div><br>I should have noted, I'm testing on 64-bit linux. <br></div></div>