|
| | QPolygon () |
| |
| | QPolygon (const QPolygon &other) |
| |
| | QPolygon (const QRect &rect, bool closed=false) |
| |
| | QPolygon (const QVector< QPoint > &points) |
| |
| | QPolygon (int size) |
| |
| | QPolygon (QPolygon &&other) |
| |
| | QPolygon (QVector< QPoint > &&points) |
| |
| | ~QPolygon () |
| |
| QRect | boundingRect () const |
| |
| bool | containsPoint (const QPoint &point, Qt::FillRule fillRule) const |
| |
| QPolygon | intersected (const QPolygon &other) const |
| |
| bool | intersects (const QPolygon &other) const |
| |
| | operator QVariant () const |
| |
| QPolygon & | operator= (const QPolygon &other) |
| |
| QPolygon & | operator= (QPolygon &&other) |
| |
| QPoint | point (int index) const |
| |
| void | point (int index, int *x, int *y) const |
| |
| void | putPoints (int index, int nPoints, const QPolygon &fromPolygon, int fromIndex=0) |
| |
| void | putPoints (int index, int nPoints, int firstx, int firsty,...) |
| |
| void | setPoint (int index, const QPoint &point) |
| |
| void | setPoint (int index, int x, int y) |
| |
| void | setPoints (int nPoints, const int *points) |
| |
| void | setPoints (int nPoints, int firstx, int firsty,...) |
| |
| QPolygon | subtracted (const QPolygon &other) const |
| |
| void | swap (QPolygon &other) |
| |
| void | translate (const QPoint &offset) |
| |
| void | translate (int dx, int dy) |
| |
| QPolygon | translated (const QPoint &offset) const |
| |
| QPolygon | translated (int dx, int dy) const |
| |
| QPolygon | united (const QPolygon &other) const |
| |
| | QVector () = default |
| |
| | QVector (const QVector< QPoint > &other) = default |
| |
| | QVector (Input_Iterator first, Input_Iterator last) |
| |
| | QVector (QVector< QPoint > &&other) = default |
| |
| | QVector (size_type size) |
| |
| | QVector (size_type size, const QPoint &value) |
| |
| | QVector (std::initializer_list< QPoint > args) |
| |
| | ~QVector () = default |
| |
| void | append (const QPoint &value) |
| |
| void | append (const QVector< QPoint > &other) |
| |
| void | append (Iter begin, Iter end) |
| |
| void | append (QPoint &&value) |
| |
| const_reference | at (size_type pos) const |
| |
| reference | back () |
| |
| const_reference | back () const |
| |
| iterator | begin () |
| |
| const_iterator | begin () const |
| |
| size_type | capacity () const |
| |
| const_iterator | cbegin () const |
| |
| const_iterator | cend () const |
| |
| void | clear () |
| |
| const_iterator | constBegin () const |
| |
| const QPoint * | constData () const |
| |
| const_iterator | constEnd () const |
| |
| const_reference | constFirst () const |
| |
| const_reference | constLast () const |
| |
| bool | contains (const QPoint &value) const |
| |
| bool | contains (const U &value) const |
| |
| size_type | count () const |
| |
| size_type | count (const QPoint &value) const |
| |
| const_reverse_iterator | crbegin () const |
| |
| const_reverse_iterator | crend () const |
| |
| QPoint * | data () |
| |
| const QPoint * | data () const |
| |
| bool | empty () const |
| |
| iterator | end () |
| |
| const_iterator | end () const |
| |
| bool | endsWith (const QPoint &value) const |
| |
| iterator | erase (const_iterator begin, const_iterator end) |
| |
| iterator | erase (const_iterator pos) |
| |
| QVector< QPoint > & | fill (const QPoint &value, size_type size=-1) |
| |
| reference | first () |
| |
| const_reference | first () const |
| |
| reference | front () |
| |
| const_reference | front () const |
| |
| size_type | indexOf (const QPoint &value, size_type from=0) const |
| |
| size_type | indexOf (const U &value, size_type from=0) const |
| |
| iterator | insert (iterator before, const QPoint &value) |
| |
| iterator | insert (iterator before, size_type count, const QPoint &value) |
| |
| iterator | insert (iterator pos, Iter begin, Iter end) |
| |
| void | insert (size_type pos, const QPoint &value) |
| |
| void | insert (size_type pos, size_type count, const QPoint &value) |
| |
| bool | isEmpty () const |
| |
| reference | last () |
| |
| const_reference | last () const |
| |
| size_type | lastIndexOf (const QPoint &value, size_type from=-1) const |
| |
| size_type | length () const |
| |
| QVector< QPoint > | mid (size_type pos, size_type length=-1) const |
| |
| void | move (size_type from, size_type to) |
| |
| bool | operator!= (const QVector< QPoint > &other) const |
| |
| QVector< QPoint > | operator+ (const QVector< QPoint > &other) const |
| |
| QVector< QPoint > & | operator+= (const QPoint &value) |
| |
| QVector< QPoint > & | operator+= (const QVector< QPoint > &other) |
| |
| QVector< QPoint > & | operator<< (const QPoint &value) |
| |
| QVector< QPoint > & | operator<< (const QVector< QPoint > &other) |
| |
| QVector< QPoint > & | operator= (const QVector< QPoint > &other) = default |
| |
| QVector< QPoint > & | operator= (QVector< QPoint > &&other) = default |
| |
| bool | operator== (const QVector< QPoint > &other) const |
| |
| reference | operator[] (size_type i) |
| |
| const_reference | operator[] (size_type i) const |
| |
| void | pop_back () |
| |
| void | pop_front () |
| |
| void | prepend (const QPoint &value) |
| |
| void | push_back (const QPoint &value) |
| |
| void | push_back (QPoint &&value) |
| |
| void | push_front (const QPoint &value) |
| |
| void | push_front (QPoint &&value) |
| |
| reverse_iterator | rbegin () |
| |
| const_reverse_iterator | rbegin () const |
| |
| void | remove (size_type pos) |
| |
| void | remove (size_type pos, size_type count) |
| |
| size_type | removeAll (const QPoint &value) |
| |
| void | removeAt (size_type pos) |
| |
| void | removeFirst () |
| |
| void | removeLast () |
| |
| bool | removeOne (const QPoint &value) |
| |
| reverse_iterator | rend () |
| |
| const_reverse_iterator | rend () const |
| |
| void | replace (size_type i, const QPoint &value) |
| |
| void | reserve (size_type size) |
| |
| void | resize (size_type size) |
| |
| size_type | size () const |
| |
| void | squeeze () |
| |
| bool | startsWith (const QPoint &value) const |
| |
| void | swap (QVector< QPoint > &other) |
| |
| QPoint | takeAt (size_type pos) |
| |
| QPoint | takeFirst () |
| |
| QPoint | takeLast () |
| |
| QList< QPoint > | toList () const |
| |
| std::vector< QPoint > | toStdVector () const |
| |
| QPoint | value (size_type pos) const |
| |
| QPoint | value (size_type pos, const QPoint &defaultValue) const |
| |
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 the streaming operator as illustrated below.
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, QLine
| void QPolygon::putPoints |
( |
int |
index, |
|
|
int |
nPoints, |
|
|
int |
firstx, |
|
|
int |
firsty, |
|
|
|
... |
|
) |
| |
Copies nPoints points from the variable argument list into this polygon from the given index.
The points are given as a sequence of integers, starting with firstx then firsty, and so on. The polygon is resized if index+nPoints exceeds its current size.
The example code creates a polygon with three points (4,5), (6,7) and (8,9), by expanding the polygon from 1 to 3 points:
polygon.putPoints(1, 2, 6,7, 8,9);
The following code has the same result, but here the putPoints() function overwrites rather than extends:
polygon.putPoints(0, 3, 4,5, 0,0, 8,9);
polygon.putPoints(1, 1, 6,7);
- See also
- setPoints()