[PyQt] Qt or PyQt problem?
"V. Armando Solé"
sole at esrf.fr
Wed Jun 3 16:37:29 BST 2009
The problem can be solved as shown below.
It seems the linux 32 bit implementation gets confused in
createIndex(row, column, a) when a is not an integer but a long. With
small values of a (10, 100, 1000), the indexId() method returns the
The solution is to call createIndex(row, column, a) with a being a
python object and not its id. The indexId() method can be masked with a
32 bit mask if it returns a negative value. I have only found that
misbehavior under linux 32bit. Windows XP and linux 64-bit behave properly.
Thanks for your time,
import PyQt4.Qt as qt
mask = 0xFFFFFFFF
def index(self, row, column, parent):
index = self.createIndex(row, column, a)
print "Next two values should be the same"
returned = index.internalId()
if returned < 0:
returned = returned & mask
print "indexInternalId = ", returned
print "id(a) = ", id(a)
print "Forcing to be the same with a 32 bit mask"
print "indexInternalId = ", index.internalId() & mask
print "id(a) = ", id(a) & mask
if __name__ == "__main__":
app = qt.QApplication()
w = Model()
More information about the PyQt