Results 1 to 6 of 6

Thread: adjust Font size to a given rect when drawText

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: adjust Font size to a given rect when drawText

    Quote Originally Posted by yartov View Post
    I have to adjust a Font size, when the user resized Widget where I draw text in a given rectangle.
    Can somebody to give me a hint or point me to the right example?
    You can use QPainter::setWindow() and QPainter::setViewport() to modify the "scale" of the painter itself. Then you can use the same font size regardless of the real widget size, because you'll be drawing in logical and not physical coordinates.

  2. #2
    Join Date
    Oct 2007
    Posts
    16
    Qt products
    Qt4
    Platforms
    MacOS X Windows
    Thanks
    3

    Default Re: adjust Font size to a given rect when drawText

    Thanks, I implemented suggestions from other guys, but I want to try your suggestion too. Looks like the right one. Thanks a lot

Similar Threads

  1. Font size calculation when painting in a QImage
    By Ishark in forum Qt Programming
    Replies: 3
    Last Post: 15th July 2007, 22:22
  2. Replies: 3
    Last Post: 30th January 2007, 07:35
  3. QTreeView font size not being set
    By forrestfsu in forum Qt Tools
    Replies: 2
    Last Post: 12th October 2006, 13:53

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
  •  
Qt is a trademark of The Qt Company.