[PyQt] QItemDelegate

Andreas Pakulat apaku at gmx.de
Thu Nov 22 14:48:43 GMT 2007


On 22.11.07 14:35:36, Alexandre Badez wrote:
> On Nov 22, 2007 2:22 PM, Andreas Pakulat <apaku at gmx.de> wrote:
> > On 22.11.07 13:54:58, Alexandre Badez wrote:
> > > By the way, is there a better than re implement the complete paint
> > method ?
> > > I mean, I just want to change the color of the line according to the
> > "type"
> > > of the node (but not in every view).
> >
> > Sure, either let the model provide the color or change the palette in
> > the styleoptions you get and let QItemDelegate::paint() do the rest with
> > the changed style option.
> >
> 
> The "problem" if it's the model who change the color, every view will be
> impact... and that's no really what I want.

Ok.

> And modified the styleoptions, is neither what I want, because it will
> impact everything...

No, I think you misunderstood. I'm not saying change the style, I said
take the styleoption argument that is passed to the paint() method and
adjust its color palette depending on the type as you wish. Then pass
the modified object on to QItemDelegate's standard paint() function.
This will only affect the listviews on which you set an instance of your
own item delegate, which is what you want - right?

Andreas

-- 
Let me put it this way: today is going to be a learning experience.


More information about the PyQt mailing list