[PyKDE] QTextEdit/LogText color question

Sundance sundance at ierne.eu.org
Sat May 31 19:10:00 BST 2003


Hello people,

I'm seeking to use the LogText kind of QTextEdit. I want to set the 
*default* text color in that widget. So far I've been unsuccessful.

I've tried to use my_textedit_widget.setColor(). Doesn't work.

So I've begun exploring the whole stylesheeting system, to no avail so 
far. I have a feeling that the solution to my problem could be as 
simple as:
  my_textedit_widget.styleSheet().item(*default item*).setColor()
But I have no idea what '*default item*' should be. "qt" didn't work. 
"html" didn't work. "body" didn't work. "font" didn't work. "" (empty 
string) didn't work. Gah! In all cases, the text remained black.

I suppose that printing '<font color="what_i_want_at_the_time">' in my 
widget's text right at creation time, and leaving this tag unclosed for 
the time being, would do it. But it feels awfully kludgy to me. I'm 
sure I'm missing the 'right' way to do it.

Does anyone have any clue about what that 'right' way would be? Thanks 
in advance!

-- S.




More information about the PyQt mailing list