QTextLayout can be used with ... rich text. No it can't.
The documentation of
QTextLayoutstates that it
can be used with both plain and rich text.
I'd like to challenge this statement. The
setTextfunction does not render rich text, and something like
setHtml, which would be the standard way to pass rich text, does not exist. Nor does something like
setTextFormat, as is used in
QStaticText. In all, I claim that
QTextLayoutdoes not render rich text.
Please prove me wrong ;-)
QTextLayout has a Method called setTextOption() with this Option you can set RichText Properties. Look here http://doc.qt.io/qt-5/qtextoption.html
Correct me if I'm wrong:
QTextOptionlet's me set a very small number of properties such as line-wrap, tab display, text direction, alignment, etc. This is not rich text, they are just "general rich text properties".
Maybe my mistake is to equate rich text with the supported HTML subset.
Why you want to use it? For your need i can recommend a QTextDocument. It has also a Draw Method