PDA

View Full Version : Custom shape of bounding rect



Kamalpreet
9th October 2014, 05:43
Hi

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


painter->drawLine(start_p, end_p);

The bounding rect of line is defined as:


QRectF Line::boundingRect() const
{
// bounding rectangle for line
return QRectF(start_p, end_p).normalized();
}

10660

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

10661

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

10662

anda_skoa
9th October 2014, 15:59
See QPolygon.

Cheers,
_