6.0.0-rc4Source

QPolygon Class

The QPolygon class is a list of points with integer coordinates. More…

Header#include <QPolygon>
CMaketarget_link_libraries(app PRIVATE Nt::Gui)
ModuleNt GUI C++ Classes
InheritsQList

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)
QPointpoint(qsizetype index) const
voidsetPoint(qsizetype index, const QPoint &point)
voidsetPoint(qsizetype index, int x, int y)
voidputPoints(qsizetype index, qsizetype count, const QPolygon &from, qsizetype fromIndex = 0)
QRectboundingRect() const
voidtranslate(int dx, int dy)
voidtranslate(const QPoint &offset)
QPolygontranslated(int dx, int dy) const
QPolygontranslated(const QPoint &offset) const
boolcontainsPoint(const QPoint &point, Qt::FillRule fillRule) const
QPolygonFtoPolygonF() 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.

[explicit] 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.