Results 1 to 2 of 2

Thread: Custom shape of bounding rect

  1. #1
    Join Date
    Aug 2014
    Posts
    13
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Custom shape of bounding rect

    Hi

    I am drawing a line using mouse clicks. The line is drawn using paint function as:

    Qt Code:
    1. painter->drawLine(start_p, end_p);
    To copy to clipboard, switch view to plain text mode 

    The bounding rect of line is defined as:

    Qt Code:
    1. QRectF Line::boundingRect() const
    2. {
    3. // bounding rectangle for line
    4. return QRectF(start_p, end_p).normalized();
    5. }
    To copy to clipboard, switch view to plain text mode 

    Screenshot from 2014-10-09 10:01:45.png

    This shows the line painted. I get the bounding rect for this as shown:

    Screenshot from 2014-10-09 10:01:25.png

    I want to have the bounding rect according to the shape of the item, something like:

    boundingrect.png

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Custom shape of bounding rect

    See QPolygon.

    Cheers,
    _

Similar Threads

  1. Replies: 0
    Last Post: 3rd February 2012, 04:08
  2. QGraphicsItemGroup bounding rect problem
    By jonks in forum Qt Programming
    Replies: 2
    Last Post: 28th October 2010, 04:02
  3. Replies: 0
    Last Post: 1st July 2010, 18:17
  4. hide bounding rect
    By dreamer in forum Qt Programming
    Replies: 1
    Last Post: 8th May 2008, 09:40
  5. Image format without bounding rect
    By dreamer in forum Qt Programming
    Replies: 5
    Last Post: 30th April 2008, 22:25

Tags for this Thread

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.