[PyKDE] Is it possible to fake multiple inheritance with PyQt ?

İsmail Dönmez ismail at uludag.org.tr
Fri Sep 9 19:03:30 BST 2005


Cuma 09 Eylül 2005 14:11 tarihinde, Eric Jardim şunları yazmıştı: 
> 2005/9/8, İsmail Dönmez <ismail at uludag.org.tr>:
> > > You are not "faking" MI, with this. You are actualy doing it.
> >
> > Yeah but its not working as say it does in C++
>
> The difference of C++ MI and Python MI, is that one is statically defined,
> and the other is resolved dynamically. For us (humans) only what matters is
> *behaviour*.
>
> > BTW, in Qt4, QThread is also a QObject.
> > Yeah I noticed too, which is a good thing.
>
> You should check python-qt4. But don't wait for threads to work with it.

I will rather wait for PyQt to support Qt4 .

>
> Then I can't use QThread functions like start() which shows this is still
>
> > not
> > 100% inheritance.
>
> Why not? I don't know how PyQt classes are implemented, but they should be
> as "new style classes". If not I suspect that MI would not work correctly.
> Anyway, there are several ways to achieve the expected behaviour.
>
> You can do something like:
> class Thread(QObject):
> def __init__(...)
> self.thread = QThread()
> ...
>
> def __getattr__(self, attr):
> return geattr(self.thread, attr)
>
> Don't give up so soon.

Well thanks for info but passing an extra QObject to __init__ is way easier 
and better than MI for _this_ case :-)

Regards,
ismail




More information about the PyQt mailing list