Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, July 2006
how to use setStyleSheet with QTextEdit


Message 1 in thread

hi there! im trying to get use of QTextEdit::getStyleSheet. im
trying to do something like that:

display->setStyleSheet(".your { background: #ffffff; } .user {
background: #e0e0e0; }");

and than in QTextEdit im appending "<table
class=\"user\"><tr><td>test</td></tr></table>" but table has white
background. Any sugestions how to make use of that?

--
 [ signature omitted ] 

Message 2 in thread

On Friday 28. July 2006 17:24, naresh@xxxxxxx wrote:
> hi there! im trying to get use of QTextEdit::getStyleSheet. im
> trying to do something like that:
>
> display->setStyleSheet(".your { background: #ffffff; } .user {
> background: #e0e0e0; }");
>
> and than in QTextEdit im appending "<table
> class=\"user\"><tr><td>test</td></tr></table>" but table has white
> background. Any sugestions how to make use of that?

Note that styleSheet is a property of QWidget and affects the widget's look. 
You may want to try the defaultStyleSheet property on the textedit's document 
instead.

The background shorthand property is not currently supported, so you have to 
use the explicit background-color property instead. (I'll see about fixing 
that for 4.2 though)

With these two changes your example works fine for me.

Simon

Attachment:

Attachment: pgpnGFhXowbE2.pgp
Description: PGP signature