Results 1 to 4 of 4

Thread: boundingRect problems

  1. #1
    Join Date
    Dec 2010
    Posts
    2
    Thanks
    1
    Qt products
    Qt4

    Default boundingRect problems

    The use of the windows

    Use the following code returns wrong value

    Well this is the bug?

    Qt Code:
    1. QFont font("times", 24);
    2. QFontMetrics myFontMetrics(font);
    3. qDebug()<<myFontMetrics.boundingRect(0,0,50,2000,Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap,"123456789012345678901234567890");
    4. //return QRect(0,0 480x36)
    To copy to clipboard, switch view to plain text mode 

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

    Default Re: boundingRect problems

    So why is this wrong?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Dec 2010
    Posts
    2
    Thanks
    1
    Qt products
    Qt4

    Default Re: boundingRect problems

    Qt::TextWordWrap breaks the text to fit the rectangle.

    But the text don't fit the rectangle
    Back to the width changed, I think fixed at 50

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: boundingRect problems

    Qt::TextWordWrap != Qt::TextWrapAnywhere. But the documentation says that you can't use Qt::TextWrapAnywhere with bounding rect. Nevertheless try it.

  5. The following user says thank you to Lykurg for this useful post:

    mefalo (8th December 2010)

Similar Threads

  1. hoverover for boundingrect qgraphicsitem
    By rogerholmes in forum Newbie
    Replies: 4
    Last Post: 11th January 2010, 20:47
  2. Why must I pad boundingRect() by 7 pixels
    By xenome in forum Qt Programming
    Replies: 3
    Last Post: 10th September 2009, 14:07
  3. boundingRect()?
    By aaron in forum Qt Programming
    Replies: 6
    Last Post: 21st April 2009, 09:43
  4. setRect vs boundingRect
    By zgulser in forum Qt Programming
    Replies: 5
    Last Post: 5th February 2009, 00:23
  5. QGraphicsItem -> boundingRect()
    By harakiri in forum Qt Programming
    Replies: 4
    Last Post: 6th March 2008, 15:02

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.