Hi Armando,<br><br><div class="gmail_quote">On Wed, Jun 3, 2009 at 9:34 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;">
Hello,<br>
<br>
I think I have fallen into a Qt bug but perhaps I am wrong.<br>
<br>
According to the (latest) Qt documentation, QAbstractItemModel.createIndex takes a uint32 as the model index internalId, while the internalId() method of QModelIndex returns a uint64. I guess my problems are coming from that inconsistency.<br>
<br>
The problem is illustrated below. On a windows machine and on a 64-bit linux machine everything is fine.<br>
<br>
On a 32-bit linux machine the given internalId (= id(a) ) and the returned internalId are not the same. In fact, one of them is negative.<br>
<br>
Both, the linux-32 machine and the windows XP machine are running sip 4.7.9, PyQt 4.4.4 and qt 4.4.3<br>
<br>
Am I missing some obvious solution to the problem?<br>
<br>
Best regards,<br>
<br>
Armando<br>
<br>
import PyQt4.Qt as qt<br>
<br>
class Model(qt.QAbstractItemModel):<br>
def index(self, row, column, parent):<br>
a=[" Hello World"]<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>
</blockquote><div> </div><div>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><br>Darren<br></div></div>