Results 1 to 3 of 3

Thread: QPainter - Retrieve drawText size

  1. #1
    Join Date
    Sep 2007
    Location
    Sant'Elpidio a Mare, Italy
    Posts
    194
    Thanks
    54
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Post QPainter - Retrieve drawText size

    Hi all,

    QPainter provides the function
    QPainter::drawText() to draw a text in a given bounding rectangle.

    Now, the situation is that I have to print a vertical list of texts and this function helps me to write a text without overriding the adjacents. It could so happen that a text requires more lines. Since I don't know how many lines it requires, is there a way to know how many of those lines it used or it is gonna to use (before drawing)?

    I looked in the documentations but I found nothing usefull. Ideas?
    Last edited by Raccoon29; 30th April 2008 at 12:45. Reason: updated contents
    --
    raccoon29

    "La mia vita finirà quando non vedrò più la gente ridere...non necessariamente alle mie battute "

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPainter - Retrieve drawText size

    You could look at QFontMetrics.
    May be it might help you

  3. The following user says thank you to aamer4yu for this useful post:

    Raccoon29 (2nd May 2008)

  4. #3
    Join Date
    Sep 2007
    Location
    Sant'Elpidio a Mare, Italy
    Posts
    194
    Thanks
    54
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: QPainter - Retrieve drawText size

    Yes, thank you for the hint, that's right what I needed
    --
    raccoon29

    "La mia vita finirà quando non vedrò più la gente ridere...non necessariamente alle mie battute "

Similar Threads

  1. adjust Font size to a given rect when drawText
    By yartov in forum Qt Programming
    Replies: 5
    Last Post: 14th May 2008, 20:03
  2. Qt drawText QPainter
    By bunjee in forum Qt Programming
    Replies: 1
    Last Post: 7th April 2008, 20:00
  3. Qt 4.1.1 linker warnings
    By Matt Smith in forum Installation and Deployment
    Replies: 0
    Last Post: 26th February 2006, 23:14

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.