PDA

View Full Version : Doubt in QGraphicsItem::boundingRect()



Gopala Krishna
19th March 2007, 04:23
Are we supposed to accomodate half of the pen width extra for non rectangular items , which draws rect only when selected ?

aamer4yu
19th March 2007, 05:29
I think yes...
from the docs...

Note: For shapes that paint an outline / stroke, it is important to include half the pen width in the bounding rect. It is not necessary to compensate for antialiasing, though.

Even if u are drawing non rectangular items, the top/bottom or right/left side will touch the rectangle...
hope i am right :D

Bitto
20th March 2007, 23:41
You are. Lines, rectangles, ellipses, every shape whose outline touches the bounding rect needs to add half the pen width in boundingRect(). All Qt's standard items do this.

Gopala Krishna
22nd March 2007, 15:57
Thanks to you both.