[PyKDE] changing background color of QTextEdit/QLineEdit

Doug Bell dougb at bellz.org
Wed Jan 17 01:32:15 GMT 2007

Steven James Samuel Stapleton wrote:
> I fiddle with this and got it working for the most part, thanks for the 
> info.
> However, I have found one thing where it doesn't work: QTextEdit objects 
> don't seem to follow the palette setup. I have the same code for the 
> TextEdits and the LineEdits (it's a "ui_good(self, ui_object)" and 
> "ui_bad(self, ui_object)" type function, where self is the container and 
> ui_object is the object to change color. The code looks pretty much like 
> what you have below. When a LineEdit is passed, it will change red with 
> ui_bad, and the light/pastel blue that is in the windows default palette 
> (my default text background) when I pass it to ui_good. When a TextEdit is 
> passed, there is no change.

The problem could be that TextEdit inherits from a scroll view, so the
central widget is a viewport, not the TextEdit itself.  Try:


More information about the PyQt mailing list