[PyQt] Qt or PyQt problem?

"V. Armando Solé" sole at esrf.fr
Wed Jun 3 14:34:18 BST 2009


I think I have fallen into a Qt bug but perhaps I am wrong.

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.

The problem is illustrated below. On a windows machine and on a 64-bit 
linux machine everything is fine.

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.

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

Am I missing some obvious solution to the problem?

Best regards,


import PyQt4.Qt as qt

class Model(qt.QAbstractItemModel):
    def index(self, row, column, parent):
        a=[" Hello World"]
        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()

More information about the PyQt mailing list