[PyKDE] QObject.inherits?

Giovanni Bajo rasky at develer.com
Mon Feb 14 18:53:10 GMT 2005


Hello,

I see this behaviour with PyQt:

>>> from qt import *
>>> a = QApplication([])
>>> class Foo(QObject):
...     pass
...
>>> f = Foo()
>>> print f.className()
Foo
>>> print f.isA("Foo")
False
>>> print f.inherits("Foo")
False
>>>

I found out this while trying to use QObject.queryList, which does not work
as expected for Python objects. One has to do:

[x for x in self.queryList() if isinstance(x, Foo)]

instead of:

self.queryList("Foo")

which is a tad more readable and easy.
-- 
Giovanni Bajo




More information about the PyQt mailing list