Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

QPolygon Class Reference

Inheritance diagram for QPolygon:

QVector< QPoint > Q3PointArray

List of all members.

Detailed Description

The QPolygon class provides a vector of points using integer precision.

A QPolygon object is a QVector<QPoint>. The easiest way to add points to a QPolygon is to use QVector's streaming operator, as illustrated below:

snippets/polygon/polygon.cpp STREAM QPolygon QPoint

In addition to the functions provided by QVector, QPolygon provides some point-specific functions.

Each point in a polygon can be retrieved by passing its index to the point() function. To populate the polygon, QPolygon provides the setPoint() function to set the point at a given index, the setPoints() function to set all the points in the polygon (resizing it to the given number of points), and the putPoints() function which copies a number of given points into the polygon from a specified index (resizing the polygon if necessary).

QPolygon provides the boundingRect() and translate() functions for geometry functions. Use the QMatrix::map() function for more general transformations of QPolygons.

The QPolygon class is {Implicit Data Sharing}{implicitly shared}.

See also:
QVector, QPolygonF, QLine

Definition at line 60 of file qpolygon.h.

Public Types

typedef const QPointconst_iterator
typedef const value_typeconst_pointer
typedef const value_typeconst_reference
typedef const_iterator ConstIterator
typedef ptrdiff_t difference_type
typedef iterator Iterator
typedef QPointiterator
typedef value_typepointer
typedef value_typereference
typedef int size_type
typedef QPoint value_type

Public Member Functions

void append (const QPoint &t)
const QPointat (int i) const
const_reference back () const
reference back ()
const_iterator begin () const
iterator begin ()
QRect boundingRect () const
int capacity () const
void clear ()
const_iterator constBegin () const
const QPointconstData () const
const_iterator constEnd () const
bool contains (const QPoint &t) const
bool containsPoint (const QPoint &pt, Qt::FillRule fillRule) const
int count () const
int count (const QPoint &t) const
const QPointdata () const
QPointdata ()
void detach ()
bool empty () const
const_iterator end () const
iterator end ()
iterator erase (iterator pos)
iterator erase (iterator begin, iterator end)
QVector< QPoint > & fill (const QPoint &t, int size=-1)
const QPointfirst () const
QPointfirst ()
const_reference front () const
QPointfront ()
int indexOf (const QPoint &t, int from=0) const
iterator insert (iterator before, const QPoint &x)
iterator insert (iterator before, int n, const QPoint &x)
void insert (int i, int n, const QPoint &t)
void insert (int i, const QPoint &t)
QPolygon intersected (const QPolygon &r) const
bool isDetached () const
bool isEmpty () const
const QPointlast () const
QPointlast ()
int lastIndexOf (const QPoint &t, int from=-1) const
QVector< QPointmid (int pos, int length=-1) const
 operator QVariant () const
bool operator!= (const QVector< QPoint > &v) const
QVector< QPointoperator+ (const QVector< QPoint > &l) const
QVector< QPoint > & operator+= (const QPoint &t)
QVector< QPoint > & operator+= (const QVector< QPoint > &l)
QVector< QPoint > & operator<< (const QVector< QPoint > &l)
QVector< QPoint > & operator<< (const QPoint &t)
bool operator== (const QVector< QPoint > &v) const
const QPointoperator[] (int i) const
QPointoperator[] (int i)
QPoint point (int i) const
void point (int i, int *x, int *y) const
void pop_back ()
void pop_front ()
void prepend (const QPoint &t)
void push_back (const QPoint &t)
void push_front (const QPoint &t)
void putPoints (int index, int nPoints, const QPolygon &from, int fromIndex=0)
void putPoints (int index, int nPoints, int firstx, int firsty,...)
void putPoints (int index, int nPoints, const int *points)
 QPolygon (int nPoints, const int *points)
 QPolygon (const QRect &r, bool closed=false)
 QPolygon (const QVector< QPoint > &v)
 QPolygon (const QPolygon &a)
 QPolygon (int size)
 QPolygon ()
void remove (int i, int n)
void remove (int i)
void replace (int i, const QPoint &t)
void reserve (int size)
void resize (int size)
void setPoint (int index, const QPoint &p)
void setPoint (int index, int x, int y)
void setPoints (int nPoints, int firstx, int firsty,...)
void setPoints (int nPoints, const int *points)
void setSharable (bool sharable)
int size () const
void squeeze ()
QPolygon subtracted (const QPolygon &r) const
QList< QPointtoList () const
std::vector< QPointtoStdVector () const
void translate (const QPoint &offset)
void translate (int dx, int dy)
QPolygon united (const QPolygon &r) const
QPoint value (int i, const QPoint &defaultValue) const
QPoint value (int i) const
 ~QPolygon ()

Static Public Member Functions

static QVector< QPointfromList (const QList< QPoint > &list)
static QVector< QPointfromStdVector (const std::vector< QPoint > &vector)

Public Attributes

QVectorTypedData< QPoint > * d
QVectorData * p

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index