[PyKDE] Problem with dynamic tooltip
Phil Thompson
phil at river-bank.demon.co.uk
Fri Nov 30 18:51:19 GMT 2001
Donovan Rebbechi wrote:
>
> On Wed, 28 Nov 2001, stsao wrote:
>
> > Hi,
> >
> > Thanks to Donovan, the problem has been resolved. Please see his reply
> > below.
> >
> > Donavan, were you able to see the other problem (background color color of
> > QMultiLineEdit not updated properly)?
>
> Part of the problem is that you're overriding a virtual method marked
> "for internal use only". If you want to do this, it's a good idea to call
> the base class version from your override.
That's the right thing to do - it doesn't matter that it's marked for
internal use - you want to supplement the existing behaviour, not
replace it.
> I get the same behaviour here as you.
>
> To fix it, you need to call the same method in the base class. I don't
> know off the top of my head how to do that in python, so my brute force
> fix is to make another method, mysetBackgroundColor.
>
> def mysetBackgroundColor(self, qColor):
> palette = self.palette()
> palette.setColor(QColorGroup.Base, qColor)
> self.setPalette(palette)
> self.setBackgroundColor(qColor)
Just call the superclass method explicitly like you do with ctors, ie...
def setBackgroundColor(self, qColor):
palette = self.palette()
palette.setColor(QColorGroup.Base, qColor)
self.setPalette(palette)
QMultiLineEdit.setBackgroundColor(self, qColor)
Phil
More information about the PyQt
mailing list