Explanation of relation between QTextLayout, QTextDocument and QTextBlock
-
Could you suggest some resources/books/tutorials explaining relations between those classes? I'm trying to render QTextBlocks from QTextDocument using QTextLayout (from the blocks) but I cannot figure out how text is rendered. Which font, color etc. are being used. When text is rendered and when it is not (I do that in paintEvent and sometimes text is rendered, sometimes not. I have no idea why. When I draw text with painter->drawText it is always drawn). What is the relation between QTextDocument's layout, individual blocks layouts (they are different right?), what QTextBlockFormat and QTextCharFormat of a block do while rendering.
Thanks for help.
-
Really, these Qt text components are designed to handle all the text rendering using a QTextEdit, but I suppose you can render the text how you like with your own classes - which is what you seem to be doing.
In any case, you'll find a lot of info about how the text document structure is stored in the Rich Text Document Structure help files.
-
Thanks, It'll help. I've also found this tutorial which is relevant:
http://www.qtcentre.org/wiki/index.php?title=Low-Level_Text_Layouts
-
That link is now dead but can be instead found at: https://doc.qt.io/archives/qq/qq24-textlayouts.html .