Why painter->setPen() doesn't work with QTextDocument?
If I have this code:
Code:
...
painter->setPen(Qt::white);
doc.setTextWidth(220);
doc.setHtml(text);
doc.documentLayout()->draw(painter, context);
the text is drawn in black instead of white? Only if i write:
Code:
doc.setHtml("<font color=\"white\">" + text + "</font>");
it works.
Regards
Re: Why painter->setPen() doesn't work with QTextDocument?
QTextFormat and its descendants are resonsible for text formatting in QTextDocument, not the painter.
Re: Why painter->setPen() doesn't work with QTextDocument?
Re: Why painter->setPen() doesn't work with QTextDocument?
Of course it's the QTextFormat what is responsible for formatting, not QTextDocument. I don't know why I wrote QTextDocument. :confused: