Results 1 to 2 of 2

Thread: Getting the bounding rectangle

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2008
    Posts
    12
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Getting the bounding rectangle

    I have implemented the following code

    Qt Code:
    1. QRectF rect(0, 0, height(), Margin);
    2. painter->save();
    3. painter->translate(50,0);
    4. painter->rotate(90);
    5. painter->drawText(rect,Qt::AlignCenter | Qt::AlignTop,str);
    6. strBoundingRect = painter->boundingRect(rect,Qt::AlignCenter,str);
    7. painter->restore();
    To copy to clipboard, switch view to plain text mode 

    However, using the above code return in strBoundingRect the initial bounding rectangle of the QString str and not the one that corresponds to the rotated and translated painter.

    Can you give me an example on how can I obtain the bounding rectangle taking also into account both translation and rotation?

    Thanks in advance...
    Last edited by ioannis; 21st May 2009 at 14:49.

Similar Threads

  1. Rotating a rectangle about its origin
    By babu198649 in forum Newbie
    Replies: 5
    Last Post: 25th October 2008, 12:24
  2. How to get a round rectangle (QRegion)
    By quzcFroal in forum Qt Programming
    Replies: 7
    Last Post: 2nd June 2008, 21:14
  3. Display rectangle on Image
    By parmar ranjit in forum Qt Programming
    Replies: 3
    Last Post: 22nd February 2008, 13:09
  4. Draw a rectangle alternating two colors with qPainter
    By SkripT in forum Qt Programming
    Replies: 12
    Last Post: 24th January 2006, 23:12
  5. How to paint a selection rectangle on a pixmap?
    By SkripT in forum Qt Programming
    Replies: 6
    Last Post: 8th January 2006, 19:52

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.