Results 1 to 3 of 3

Thread: DrawText ?

  1. #1
    Join Date
    May 2006
    Posts
    108
    Thanks
    35
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Question DrawText ?

    Hi,

    i draw text like this:

    Qt Code:
    1. drawText ( width()/2, height()/2, "a very long long text" );
    To copy to clipboard, switch view to plain text mode 

    How can i make a wordwrap if the text size more as the QWidget size?

    Thanks in advance,

    Whitefurrows

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: DrawText ?

    Use the version of drawText that takes a QTextOption. You can adjust word wrapping there. I think the variant that takes a QRect as its first parameter will work as well.

    Qt Code:
    1. drawText(rect(), Qt::AlignCenter, "a very long long text", rect());
    To copy to clipboard, switch view to plain text mode 

  3. The following 2 users say thank you to wysota for this useful post:

    mero (30th September 2012), whitefurrows (14th February 2007)

  4. #3
    Join Date
    May 2006
    Posts
    108
    Thanks
    35
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Thumbs up Re: DrawText ?

    That's it, work fine. Thank you!

Similar Threads

  1. drawText
    By pwqiang in forum Qt Programming
    Replies: 1
    Last Post: 19th December 2006, 08:52
  2. QRectF and drawText
    By aronsson in forum Qt Programming
    Replies: 1
    Last Post: 4th July 2006, 16:05
  3. drawText problem
    By happylucy in forum Qt for Embedded and Mobile
    Replies: 11
    Last Post: 20th April 2006, 00:31
  4. drawText (QT/E 2.3.10)
    By agaf in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 4th February 2006, 11:48

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.