QCanvasPolygonalItem(3qt)

NAME
QCanvasPolygonalItem - A

#include <qcanvas.h>

Inherits QCanvasItem.

Inherited by QCanvasEllipse, QCanvasLine, QCanvasPolygon and QCanvasRectangle.

  Public Members
QCanvasPolygonalItem ( QCanvas * canvas )
virtual ~QCanvasPolygonalItem ()
virtual void setPen ( QPen p )
virtual void setBrush ( QBrush b )
QPen pen () const
QBrush brush () const
virtual QPointArray areaPoints () const
virtual QPointArray areaPointsAdvanced () const
virtual QRect boundingRect () const
virtual int rtti () const

  Protected Members
virtual void draw ( QPainter & )
virtual void drawShape ( QPainter & )
bool winding () const
void setWinding ( bool )

DESCRIPTION
A QCanvasItem which renders itself in a polygonal area.

QCanvasPolygonalItem is an abstract class that is useful for all items which cover a polygonal area of the canvas. QCanvasSprite and QCanvasText, the other branches of QCanvasItem derivatives usually cover a simple rectangular area and are dealt with specially, but typical geometric shapes such as lines and circles would be too inefficiently bounded by rectangular areas - a diagonal line from one corner of the canvas area to the other would be bounded by a rectangle covering the entire area! QCanvasPolygonalItem objects allow the area to be defined by a polygon - a sequence of points bounding the area covered by the item.

Derived classes should try to define as small as possible an area to maximize efficiency, but must definately be contained completely within the polygonal area. Calculating the exact requirements may be difficult, but a small amount of over-estimation is better than any under-estimation, which will give drawing errors.

All subclasses must call hide() in their destructor while the functions numAreaPoints() and getAreaPoints() are valid.

MEMBER FUNCTION DOCUMENTATION

QCanvasPolygonalItem::QCanvasPolygonalItem ( QCanvas * canvas )
Constructs a QCanvasPolygonalItem on canvas.

QCanvasPolygonalItem::~QCanvasPolygonalItem () [virtual]
Destruct the QCanvasPolygonalItem. Derived classes must call hide() in their destructor, as this destructor cannot call the virtual methods.

QPointArray QCanvasPolygonalItem::areaPoints () const [virtual]
Must return the points bounding the shape. Note that the returned points are outside the object, not touching it.

Reimplemented in QCanvasPolygon, QCanvasLine, QCanvasRectangle and QCanvasEllipse.

QPointArray QCanvasPolygonalItem::areaPointsAdvanced () const [virtual]
Returns the points advanced by the current xVelocity() and yVelocity().

QRect QCanvasPolygonalItem::boundingRect () const [virtual]
Returns the bounding rectangle of the polygonal item, based on areaPoints().

Reimplemented from QCanvasItem.

QBrush QCanvasPolygonalItem::brush () const
Returns the QBrush used to fill the item, if filled.

See also setBrush().

bool QCanvasPolygonalItem::collidesWith ( const QCanvasItem * i ) const [virtual]
Reimplemented for internal reasons; the API is not affected.

Reimplemented from QCanvasItem.

void QCanvasPolygonalItem::draw ( QPainter & p ) [virtual protected]
Reimplemented from QCanvasItem, this draws the item by setting the pen and brush on p and calling drawShape().

Reimplemented from QCanvasItem.

void QCanvasPolygonalItem::drawShape ( QPainter & p ) [virtual protected]
Subclasses must reimplement this function to draw their shape. The pen and brush of p are already set to pen() and brush() prior to calling this function.

See also draw().

Reimplemented in QCanvasPolygon, QCanvasEllipse, QCanvasLine and QCanvasRectangle.

QPen QCanvasPolygonalItem::pen () const
Returns the QPen used to draw the outline of the item, if any.

See also setPen().

int QCanvasPolygonalItem::rtti () const [virtual]
Returns 2.

See also QCanvasItem::rtti().

Reimplemented from QCanvasItem.

void QCanvasPolygonalItem::setBrush ( QBrush b ) [virtual]
Sets the QBrush used when drawing item.

See also setPen(), brush() and drawShape().

void QCanvasPolygonalItem::setPen ( QPen p ) [virtual]
Sets the QPen used when drawing the item. Note that many QCanvasPolygonalItem do not use the pen value.

See also setBrush(), pen() and drawShape().

Reimplemented in QCanvasLine.

void QCanvasPolygonalItem::setWinding ( bool enable ) [protected]
Sets whether the polygonal item to use winding algorithm for determine the "inside" of the polygon, rather than the odd-even algorithm.

See also winding().

bool QCanvasPolygonalItem::winding () const [protected]
Returns TRUE if the polygonal item uses the winding algorithm for determine the "inside" of the polygon, of FALSE if it uses the odd-even algorithm.

See also setWinding().

SEE ALSO
http://doc.trolltech.com/qcanvaspolygonalitem.html http://www.trolltech.com/faq/tech.html

COPYRIGHT
Copyright 1992-2001 Trolltech AS, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.

AUTHOR
Generated automatically from the source code.

BUGS
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports make our job much simpler. Thank you.

In case of content or formattting problems with this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qcanvaspolygonalitem.3) and the Qt version (2.3.2).