|  | Home · Overviews · Examples |

# QPolygon Class Reference
[com.trolltech.qt.gui module]

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

## 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:

                QPolygon polygon;
                polygon << QPoint(10, 20) << QPoint(20, 30);

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 implicitly shared.

See also `QVector`, `QPolygonF`, and `QLine`.