PDA

View Full Version : QTextEdit not adhering to CSS



elahav
14th May 2008, 16:24
I would like to use CSS style sheets to format the HTML contents of a QTextEdit widget. It seems, however, that the widget supports a very restricted set of properties. Specifically, I cannot make it display borders or apply padding. I am able to set the background color and text margins.
The same HTML code displays correctly in a browser.
Is this a known limitation, a bug, or am I doing something wrong?

Brandybuck
14th May 2008, 19:53
It's a known limitation. QTextEdit only supports a limited subset of HTML and CSS. It was meant to be a rich text editor, and not a full HTML/CSS rendering engine. Please see http://doc.trolltech.com/4.4/richtext-html-subset.html

However, it does support padding and borders. Maybe if you post your HTML string we can see what is wrong.

elahav
14th May 2008, 20:06
Thanks.
According to the linked document, borders and paddings are only supported for tables. I was trying to get a <pre> block formatted.