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. Qt iterate over rich text document

Qt iterate over rich text document

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 478 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.
  • D Offline
    D Offline
    Delphi251189
    wrote on last edited by Delphi251189
    #1

    Hi, I need to iterate over QTextDocument and for each block I need to know absolute position of top left corner of a block relative to document (in pixels): Is there any way?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      Delphi251189
      wrote on last edited by
      #2

      86d63ece-ade4-414b-8f05-cc75fba820ce-image.png

      something like this for each TextBlocks

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Delphi251189
        wrote on last edited by
        #3

        The offical documentation says something about QTextBlock or QTextFragment positions like this
        https://doc.qt.io/qt-5/qtextfragment.html#position
        but as far as I understand this is not what I'm looking for, because these functions return int instead of QPoint or QPointF

        1 Reply Last reply
        0
        • B Offline
          B Offline
          Bonnie
          wrote on last edited by
          #4

          What about https://doc.qt.io/qt-5/qabstracttextdocumentlayout.html#blockBoundingRect ?
          Get the layout from https://doc.qt.io/qt-5/qtextdocument.html#documentLayout

          D 1 Reply Last reply
          2
          • B Bonnie

            What about https://doc.qt.io/qt-5/qabstracttextdocumentlayout.html#blockBoundingRect ?
            Get the layout from https://doc.qt.io/qt-5/qtextdocument.html#documentLayout

            D Offline
            D Offline
            Delphi251189
            wrote on last edited by
            #5

            Thank You @Bonnie!!! This is exactly what I am looking for

            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