Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Explanation of relation between QTextLayout, QTextDocument and QTextBlock

Explanation of relation between QTextLayout, QTextDocument and QTextBlock

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kubuś_
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • V Offline
      V Offline
      Vaquita Tim
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kubuś_
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SlySven
          wrote on last edited by
          #4

          That link is now dead but can be instead found at: https://doc.qt.io/archives/qq/qq24-textlayouts.html .

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved