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. [SOLVED]drawText() on multiple line
QtWS25 Last Chance

[SOLVED]drawText() on multiple line

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 17.4k 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.
  • V Offline
    V Offline
    Vetryaspa
    wrote on last edited by
    #1

    Hi all,

    i have the necessity to draw text on a multiple line for create something like a QTextEdit in the Designer but with alone drawtext() i can't do this. other this i have a text to long and is more difficult calculate the string lenght for make a "for cycle" and draw line to line...

    Anyone can halp me?

    regard

    1 Reply Last reply
    0
    • M Offline
      M Offline
      msx_br
      wrote on last edited by
      #2

      Try:

      @
      painter->drawText(this->rect(), Qt::AlignCenter, "Qt by\nNokia");
      @

      I'v tested, and worked.

      This was done inside a QGraphicsView

      msx_br - Brazil (Netherlands)

      1 Reply Last reply
      1
      • V Offline
        V Offline
        Vetryaspa
        wrote on last edited by
        #3

        but i not have ever the same text, i pick from DB and it isn't the way to operate because i can't control and modify the text....

        1 Reply Last reply
        0
        • C Offline
          C Offline
          cincirin
          wrote on last edited by
          #4

          Use "this overloaded drawText":http://qt-project.org/doc/qt-4.8/qpainter.html#drawText-10 with Qt::TextWordWrap flag

          1 Reply Last reply
          0
          • V Offline
            V Offline
            Vetryaspa
            wrote on last edited by
            #5

            [quote author="cincirin" date="1331726961"]Use "this overloaded drawText":http://qt-project.org/doc/qt-4.8/qpainter.html#drawText-10 with Qt::TextWordWrap flag[/quote]

            Run!!! Tanx so much!!!

            1 Reply Last reply
            0
            • C Offline
              C Offline
              cincirin
              wrote on last edited by
              #6

              [quote author="Vetryaspa" date="1331733990"]
              [quote author="cincirin" date="1331726961"]Use "this overloaded drawText":http://qt-project.org/doc/qt-4.8/qpainter.html#drawText-10 with Qt::TextWordWrap flag[/quote]

              Run!!! Tanx so much!!![/quote]
              You are welcome :-)

              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