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