[PyQt] Qt or PyQt problem?

"V. Armando Solé" sole at esrf.fr
Wed Jun 3 16:11:35 BST 2009


Dear Darren,

There is something weird going on under linux 32 bit.

The code below works fine on windows.

On linux 64 bit, it is fine either after masking the values, either 
supplying a 32-bit masked identifier. That illustrates the fact the 
intended behavior of  internalId() is to return the supplied value.

I cannot get the same values under linux 32-bit either with or without 
masking.

Armando

import PyQt4.Qt as qt
import random
import sys

mask = 0xFFFFFFFF

class Model(qt.QAbstractItemModel):
  def index(self, row, column, parent):
      a=[random.random()]
      if False:
            index =  self.createIndex(row, column, id(a) & mask)  #This 
forces a 32bit identifier but not OK on 32 bit
      else:
            index =  self.createIndex(row, column, id(a))         #This 
is still OK after masking to 32bit
      print "Next two values should be the same"
      print "indexInternalId = ", index.internalId()
      print "id(a) = ", id(a), "0x%x" % id(a)
      print "Forcing to be the same with a 32 bit mask"
      print "indexInternalId = ", index.internalId() & mask
      print "id(a) = ", id(a) & mask
      return index

if __name__ == "__main__":
  app = qt.QApplication([])
  w = Model()
  w.index(0,0,None)




More information about the PyQt mailing list