The QCanvasPolygonalItem class provides a polygonal canvas item on a QCanvas.
.PP
The mostly rectangular classes, such as QCanvasSprite and QCanvasText, use the object's bounding rectangle for movement, repainting and collision calculations. For most other items, the bounding rectangle can be far too large -- a diagonal line being the worst case, and there are many other cases which are also bad. QCanvasPolygonalItem provides polygon-based bounding rectangle handling, etc., which is much faster for non-rectangular items.
Derived classes should try to define as small an area as possible to maximize efficiency, but the polygon must \fIdefinitely\fR be contained completely within the polygonal area. Calculating the exact requirements is usually difficult, but if you allow a small overestimate it can be easy and tquick, while still getting almost all of QCanvasPolygonalItem's speed.
Note that all subclasses \fImust\fR call hide() in their destructor since hide() needs to be able to access areaPoints().
.PP
Normally, QCanvasPolygonalItem uses the odd-even algorithm for determining whether an object intersects this object. You can change this to the winding algorithm using setWinding().
.PP
The bounding rectangle is available using boundingRect(). The points bounding the polygonal item are retrieved with areaPoints(). Use areaPointsAdvanced() to retrieve the bounding points the polygonal item \fIwill\fR have after QCanvasItem::advance(1) has been called.
.PP
If the shape of the polygonal item is about to change while the item is visible, call invalidate() before updating with a different result from areaPoints().
.PP
By default, QCanvasPolygonalItem objects have a black pen and no brush (the default QPen and QBrush constructors). You can change this with setPen() and setBrush(), but note that some QCanvasPolygonalItem subclasses only use the brush, ignoring the pen setting.
.PP
The polygonal item can be drawn on a painter with draw(). Subclasses must reimplement drawShape() to draw themselves.
.PP
Like any other canvas item polygonal items can be moved with QCanvasItem::move() and QCanvasItem::moveBy(), or by setting coordinates with QCanvasItem::setX(), QCanvasItem::setY() and QCanvasItem::setZ().
.PP
See also Graphics Classes and Image Processing Classes.
This function must be reimplemented by subclasses. It \fImust\fR return the points bounding (i.e. outside and not touching) the shape or drawing errors will occur.
Returns the points the polygonal item \fIwill\fR have after QCanvasItem::advance(1) is called, i.e. what the points are when advanced by the current xVelocity() and yVelocity().
Returns the bounding rectangle of the polygonal item, based on areaPoints().
.PP
Reimplemented from QCanvasItem.
.SH "QBrush QCanvasPolygonalItem::brush () const"
Returns the QBrush used to fill the item, if filled.
.PP
See also setBrush().
.SH "void QCanvasPolygonalItem::draw ( QPainter & p )\fC [virtual protected]\fR"
Reimplemented from QCanvasItem, this draws the polygonal item by setting the pen and brush for the item on the painter \fIp\fR and calling drawShape().
Subclasses must reimplement this function to draw their shape. The pen and brush of \fIp\fR are already set to pen() and brush() prior to calling this function.
.PP
\fBWarning:\fR When you reimplement this function, make sure that you leave the painter in the same state as you found it. For example, if you start by calling QPainter::translate(50, 50), end your code by calling QPainter::translate(-50, -50). Be also aware that the painter might already have some transformations set (i.e., don't call QPainter::resetXForm() when you're done).
.PP
See also draw().
.PP
Reimplemented in QCanvasRectangle, QCanvasPolygon, and QCanvasEllipse.
Invalidates all information about the area covered by the canvas item. The item will be updated automatically on the next call that changes the item's status, for example, move() or update(). Call this function if you are going to change the shape of the item (as returned by areaPoints()) while the item is visible.
If \fIenable\fR is TRUE, the polygonal item will use the winding algorithm to determine the "inside" of the polygon; otherwise the odd-even algorithm will be used.
Returns TRUE if the polygonal item uses the winding algorithm to determine the "inside" of the polygon. Returns FALSE if it uses the odd-even algorithm.