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. QPainter.drawText() - where painter finished drawing text

QPainter.drawText() - where painter finished drawing text

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 290 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.
  • B Offline
    B Offline
    BartoszT
    wrote on last edited by
    #1

    Can you somehow determine the area where the drawText function painted the text?
    I need to know (coordinates) where the painter finished painting the text.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You can pass the exact rectangle where you want your text written. Isn't it enough for your purpose ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • B Offline
        B Offline
        BartoszT
        wrote on last edited by
        #3

        No, text can have many fonts and sizes.
        Is there any way to calculate pixel text width?

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @BartoszT said in QPainter.drawText() - where painter finished drawing text:

          Is there any way to calculate pixel text width?

          Seee QFontMetrics

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          1
          • B Offline
            B Offline
            BartoszT
            wrote on last edited by
            #5

            Thanks, it works.

            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