3
votes

I'm trying to put an horizontal line in a QTextDocument. I'm using HTML for the formatting. To draw the line I want, I naturally used the <hr /> tag. But the line is drawn gray and and I'd like to change its color to black.

The styles doesn't seem to apply on the hr element, so is there a simple workaround to have horizontal black line in my document?

Thanks.

2
If you want more people to see your question, add qt tag with qt4, it has 4 times more followers)Raiv
Did you try to set background-color or color property?useraged

2 Answers

0
votes

Coming from HTML, <hr> does not really have the ability to be colored or formatted. IE did it with color, Mozilla with background-color etc. So the best (both in HTML/css and QTextDocument) is to avoid <hr> and take instead any very small element, size it appropriately and give it a border and a background-color of same color as the border. E.g. a table row. I can dig up some code tomorrow or the day after - I have done this before so it must be somewhere.

0
votes

As a workaround you can use some pixels height div with appropriate background-color.