QtBase
v6.3.1
|
The QPolygonF class provides a list of points using floating point precision. \inmodule QtGui. More...
#include <qpolygon.h>
Related Functions | |
(Note that these are not member functions.) | |
QDataStream & | operator<< (QDataStream &stream, const QPolygonF &polygon) |
QDataStream & | operator>> (QDataStream &stream, QPolygonF &polygon) |
Additional Inherited Members | |
Public Types inherited from QList< QPointF > | |
using | Type = QPointF |
using | value_type = QPointF |
using | pointer = QPointF * |
using | const_pointer = const QPointF * |
using | reference = QPointF & |
using | const_reference = const QPointF & |
using | size_type = qsizetype |
using | difference_type = qptrdiff |
using | parameter_type = typename DataPointer::parameter_type |
using | rvalue_ref = typename std::conditional< DataPointer::pass_parameter_by_value, DisableRValueRefs, QPointF && >::type |
using | Iterator = iterator |
using | ConstIterator = const_iterator |
using | reverse_iterator = std::reverse_iterator< iterator > |
using | const_reverse_iterator = std::reverse_iterator< const_iterator > |
Static Public Member Functions inherited from QList< QPointF > | |
static QList< QPointF > | fromList (const QList< QPointF > &list) noexcept |
static QList< QPointF > | fromVector (const QList< QPointF > &vector) noexcept |
static QList< QPointF > | fromReadOnlyData (const QPointF(&t)[N]) noexcept |
Protected Types inherited from QListSpecialMethodsBase< T > | |
using | Self = QList< T > |
Protected Member Functions inherited from QListSpecialMethods< QPointF > | |
~QListSpecialMethods ()=default | |
Protected Member Functions inherited from QListSpecialMethodsBase< T > | |
~QListSpecialMethodsBase ()=default | |
Self * | self () |
const Self * | self () const |
The QPolygonF class provides a list of points using floating point precision. \inmodule QtGui.
\reentrant
A QPolygonF is a QList<QPointF>. The easiest way to add points to a QPolygonF is to use its streaming operator, as illustrated below:
In addition to the functions provided by QList, QPolygonF provides the boundingRect() and translate() functions for geometry operations. Use the QTransform::map() function for more general transformations of QPolygonFs.
QPolygonF also provides the isClosed() function to determine whether a polygon's start and end points are the same, and the toPolygon() function returning an integer precision copy of this polygon.
The QPolygonF class is \l {Implicit Data Sharing}{implicitly shared}.
Definition at line 127 of file qpolygon.h.
|
default |
Constructs a polygon with no points.
Constructs a polygon containing the specified points.
Definition at line 132 of file qpolygon.h.
Definition at line 133 of file qpolygon.h.
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.
Definition at line 520 of file qpolygon.cpp.
Constructs a float based polygon from the specified integer based polygon.
Definition at line 539 of file qpolygon.cpp.
QRectF QPolygonF::boundingRect | ( | ) | const |
Returns the bounding rectangle of the polygon, or QRectF(0,0,0,0) if the polygon is empty.
Definition at line 614 of file qpolygon.cpp.
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
.
Definition at line 787 of file qpolygon.cpp.
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.
Definition at line 948 of file qpolygon.cpp.
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.
Definition at line 985 of file qpolygon.cpp.
|
inline |
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.
Definition at line 148 of file qpolygon.h.
QPolygonF::operator QVariant | ( | ) | const |
Returns the polygon as a QVariant.
Definition at line 997 of file qpolygon.cpp.
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.
Definition at line 966 of file qpolygon.cpp.
Swaps polygon other with this polygon. This operation is very fast and never fails.
Definition at line 136 of file qpolygon.h.
QPolygon QPolygonF::toPolygon | ( | ) | const |
Creates and returns a QPolygon by converting each QPointF to a QPoint.
Definition at line 645 of file qpolygon.cpp.
Translate all points in the polygon by the given offset.
Definition at line 552 of file qpolygon.cpp.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Translates all points in the polygon by ({dx}, {dy}).
Definition at line 174 of file qpolygon.h.
Returns a copy of the polygon that is translated by the given offset.
Definition at line 580 of file qpolygon.cpp.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns a copy of the polygon that is translated by ({dx}, {dy}).
Definition at line 177 of file qpolygon.h.
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.
Definition at line 929 of file qpolygon.cpp.
|
related |
Writes the given polygon to the given stream, and returns a reference to the stream.
Definition at line 729 of file qpolygon.cpp.
|
related |
Reads a polygon from the given stream into the given polygon, and returns a reference to the stream.
Definition at line 750 of file qpolygon.cpp.