[PyQt] Qt or PyQt problem?
Darren Dale
dsdale24 at gmail.com
Wed Jun 3 15:16:40 BST 2009
Hi Armando,
On Wed, Jun 3, 2009 at 9:34 AM, "V. Armando Solé" <sole at esrf.fr> wrote:
> Hello,
>
> 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,
>
> Armando
>
> 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()
> w.index(0,0,None)
>
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.
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.
By the way, is your windows machine 32 or 64 bit?
Darren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090603/5d9518ff/attachment-0001.html
More information about the PyQt
mailing list