QPolygon Class
The QPolygon class is a list of points with integer coordinates. More…
| Header | #include <QPolygon> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Gui) |
| Module | Nt GUI C++ Classes |
| Inherits | QList |
List of all members, including inherited members
Public Functions
| QPolygon() | |
| QPolygon(const QList<QPoint> &points) | |
| QPolygon(std::initializer_list<QPoint> points) | |
| QPolygon(qsizetype size) | |
| QPolygon(const QRect &rectangle, bool closed = false) | |
| QPoint | point(qsizetype index) const |
| void | setPoint(qsizetype index, const QPoint &point) |
| void | setPoint(qsizetype index, int x, int y) |
| void | putPoints(qsizetype index, qsizetype count, const QPolygon &from, qsizetype fromIndex = 0) |
| QRect | boundingRect() const |
| void | translate(int dx, int dy) |
| void | translate(const QPoint &offset) |
| QPolygon | translated(int dx, int dy) const |
| QPolygon | translated(const QPoint &offset) const |
| bool | containsPoint(const QPoint &point, Qt::FillRule fillRule) const |
| QPolygonF | toPolygonF() const |
Detailed Description
See also QPolygonF and QPainter::drawPolygon().
Differences from Qt
There are no setPoints() and putPoints() taking variadic coordinates, and no united(), intersected() or subtracted().
Member Function Documentation
QPolygon::QPolygon()
Constructs an empty polygon.
QPolygon::QPolygon(const QList<QPoint> &points)
Constructs a polygon of points.
QPolygon::QPolygon(std::initializer_list<QPoint> points)
Constructs a polygon of points.
QPolygon::QPolygon(qsizetype size)
Constructs a polygon of size points at the origin.
QPolygon::QPolygon(const QRect &rectangle, bool closed = false)
Constructs the polygon of the corners of rectangle, with the first corner repeated at the end if closed is true.
QRect QPolygon::boundingRect() const
Returns the smallest rectangle that contains the points.
bool QPolygon::containsPoint(const QPoint &point, Qt::FillRule fillRule) const
Returns true if point is inside the polygon, closed, with fillRule; otherwise returns false.
QPoint QPolygon::point(qsizetype index) const
Returns the point at index.
void QPolygon::putPoints(qsizetype index, qsizetype count, const QPolygon &from, qsizetype fromIndex = 0)
Copies count points of from, starting at fromIndex, to this polygon at index, growing it if needed.
void QPolygon::setPoint(qsizetype index, const QPoint &point)
Sets the point at index to point.
void QPolygon::setPoint(qsizetype index, int x, int y)
This is an overloaded function.
Sets the point at index to (x, y).
QPolygonF QPolygon::toPolygonF() const
Returns the polygon with real coordinates.
void QPolygon::translate(int dx, int dy)
Moves each point by dx and dy.
void QPolygon::translate(const QPoint &offset)
This is an overloaded function.
Moves each point by offset.
QPolygon QPolygon::translated(int dx, int dy) const
Returns a copy moved by dx and dy.
QPolygon QPolygon::translated(const QPoint &offset) const
This is an overloaded function.
Returns a copy moved by offset.