QPolygonF Class | Qt GUI 5.15.18 (original) (raw)

The QPolygonF class provides a vector of points using floating point precision. More...

Member Function Documentation

QPolygonF::QPolygonF(const QPolygonF &polygon)

Constructs a copy of the given polygon.

QPolygonF::QPolygonF(const QPolygon &polygon)

Constructs a float based polygon from the specified integer based polygon.

See also toPolygon().

QPolygonF::QPolygonF(const QRectF &rectangle)

Constructs a closed polygon from the specified rectangle.

The polygon contains the four vertices of the rectangle in clockwise order starting and ending with the top-left vertex.

See also isClosed().

QPolygonF::QPolygonF(const QVector<QPointF> &points)

Constructs a polygon containing the specified points.

QPolygonF::QPolygonF(int size)

Constructs a polygon of the given size. Creates an empty polygon if size == 0.

See also QVector::isEmpty().

QPolygonF::QPolygonF()

Constructs a polygon with no points.

See also QVector::isEmpty().

QPolygonF::~QPolygonF()

Destroys the polygon.

QRectF QPolygonF::boundingRect() const

Returns the bounding rectangle of the polygon, or QRectF(0,0,0,0) if the polygon is empty.

See also QVector::isEmpty().

bool QPolygonF::containsPoint(const QPointF &point, Qt::FillRule fillRule) const

Returns true if the given point is inside the polygon according to the specified fillRule; otherwise returns false.

This function was introduced in Qt 4.3.

QPolygonF QPolygonF::intersected(const QPolygonF &r) const

Returns a polygon which is the intersection of this polygon and r.

Set operations on polygons will treat the polygons as areas. Non-closed polygons will be treated as implicitly closed.

This function was introduced in Qt 4.3.

See also intersects().

bool QPolygonF::intersects(const QPolygonF &p) const

Returns true if the current polygon intersects at any point the given polygon p. Also returns true if the current polygon contains or is contained by any part of p.

Set operations on polygons will treat the polygons as areas. Non-closed polygons will be treated as implicitly closed.

This function was introduced in Qt 5.10.

See also intersected().

bool QPolygonF::isClosed() const

Returns true if the polygon is closed; otherwise returns false.

A polygon is said to be closed if its start point and end point are equal.

See also QVector::first() and QVector::last().

QPolygonF QPolygonF::subtracted(const QPolygonF &r) const

Returns a polygon which is r subtracted from this polygon.

Set operations on polygons will treat the polygons as areas. Non-closed polygons will be treated as implicitly closed.

This function was introduced in Qt 4.3.

void QPolygonF::swap(QPolygonF &other)

Swaps polygon other with this polygon. This operation is very fast and never fails.

This function was introduced in Qt 4.8.

QPolygon QPolygonF::toPolygon() const

Creates and returns a QPolygon by converting each QPointF to a QPoint.

See also QPointF::toPoint().

void QPolygonF::translate(const QPointF &offset)

Translate all points in the polygon by the given offset.

See also translated().

void QPolygonF::translate(qreal dx, qreal dy)

This is an overloaded function.

Translates all points in the polygon by (dx, dy).

See also translated().

QPolygonF QPolygonF::translated(const QPointF &offset) const

Returns a copy of the polygon that is translated by the given offset.

This function was introduced in Qt 4.6.

See also translate().

QPolygonF QPolygonF::translated(qreal dx, qreal dy) const

This is an overloaded function.

Returns a copy of the polygon that is translated by (dx, dy).

This function was introduced in Qt 4.6.

See also translate().

QPolygonF QPolygonF::united(const QPolygonF &r) const

Returns a polygon which is the union of this polygon and r.

Set operations on polygons will treat the polygons as areas. Non-closed polygons will be treated as implicitly closed.

This function was introduced in Qt 4.3.

See also intersected() and subtracted().

QVariant QPolygonF::operator QVariant() const

Returns the polygon as a QVariant.