Hi Vincent,

On Monday 25 November 2002 21:54, Vincent Wagelaar wrote:
> On Monday 25 November 2002 14:06, Michael Lauer wrote:
> > Am Son, 2002-11-24 um 23.35 schrieb Vincent Wagelaar:
> > > I am currently working with a QListView and QListViewItem. If I don't
> > > derive from these objects speed is great, but derived these objects
> > > become very slow.
> >
> > First of all -
> > you are experiencing an inherent fact in the nature of Python bindings
> > which support deriving and virtual methods. If you don't subclass,
> > there's nearly no Python code involved - if you do subclass, your
> > (really really slow - compared to the speed of executing code in C/C++
> > extension modules) Python code is called. There's nothing you can do
> > about this fact.

[...]

> I think I'll will have to go for the SIP-method because I'm overloading the
> paint method in QListViewItem (called a lot).
>
> The code looks like:
>
> class MyListViewItem(QListViewItem):
>       def paint():
>               # My overridden paint stuff
>       def key():
>               # My overloaded sorting stuff...
>
> Overloading QListView shouldn't give a performance degradation because it's
> only called once. Nothing compared to how many times MyListViewItem is
> called.

I can imagine this would give a nice example. If you like to share some code, 
I'm going to prepare one.

> > If this all don't work for you, then I'm afraid you have to implement
> > your derived class in C++ and use sip to bind this and use it from
> > Python.
>
> I'm affraid so too, but shouldn't give that many troubles. I've also tried
> Psyco but that didn't give a speed boost either.
>
> Thanks for the reply
>
> Vincent

Bye,
Hans-Peter

_______________________________________________
PyKDE mailing list    [EMAIL PROTECTED]
http://mats.gmd.de/mailman/listinfo/pykde

Reply via email to