PDA

View Full Version : horizontal line / QTextDocument



migel
10th August 2012, 12:01
I use QTextDocument for QStyledItemDelegate.

I need to draw 1px height horizontal line. <hr> does the trick but only width attr is accepted. I need to change its color instead of plain black.
Below html draws 2px line instead of 1px. I wonder why this is happening.


<p style='background:green;font-size:1px;height:1px;line-height:1px;padding:0;margin:0;'>&nbsp</p>

I tried also filling 1x1px of png image with repeat-x, but looks like repeat-x is ignored and it fill sentire space of the tag which gimme also 2px of height no matter what.

Looks like also "border" attr is ignored in QTextDocument as well, so cannot use it.

Any ideas how to it properly ?

Thanks

spirit
10th August 2012, 12:21
Note, that QTextDocument doesn't have full HTML support. Here (http://qt-project.org/doc/qt-4.8/richtext-html-subset.html) is the list of the Supported HTML Subset.
You might also look at these (http://qt-project.org/doc/qt-4.8/examples-richtext.html) examples.

migel
10th August 2012, 12:40
I noticed that. I solved that by making an image of 1px width and 2px height. So first top pixel is a color that what I want, second below pixel I made it transparency.


<div style='font-size:1px;height:1px;line-height:1px;padding:0;margin:0;background-image: url(:icons/hr.png);background-repeat: repeat-x;'>&nbsp;</div></p>

So what I see is my 1px height.

migel
14th August 2012, 20:21
Looks like background-image does not work for OSX - FFS