![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
The QPolygonF class provides a list of points using floating point precision. More...
#include <qpolygon.h>
Public Member Functions | |
QPolygonF ()=default | |
Constructs a polygon with no points. | |
Q_IMPLICIT | QPolygonF (const QList< QPointF > &v) |
Constructs a polygon containing the specified points. | |
Q_IMPLICIT | QPolygonF (QList< QPointF > &&v) noexcept |
Q_IMPLICIT Q_GUI_EXPORT | QPolygonF (const QRectF &r) |
Constructs a closed polygon from the specified rectangle. | |
Q_IMPLICIT Q_GUI_EXPORT | QPolygonF (const QPolygon &a) |
Constructs a float based polygon from the specified integer based polygon. | |
void | swap (QPolygonF &other) |
Q_GUI_EXPORT | operator QVariant () const |
Returns the polygon as a QVariant. | |
void | translate (qreal dx, qreal dy) |
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}). | |
void Q_GUI_EXPORT | translate (const QPointF &offset) |
Translate all points in the polygon by the given offset. | |
QPolygonF | translated (qreal dx, qreal dy) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
Q_GUI_EXPORT QPolygonF | translated (const QPointF &offset) const |
Returns a copy of the polygon that is translated by the given offset. | |
QPolygon Q_GUI_EXPORT | toPolygon () const |
Creates and returns a QPolygon by converting each QPointF to a QPoint. | |
bool | isClosed () const |
Returns true if the polygon is closed; otherwise returns false . | |
QRectF Q_GUI_EXPORT | boundingRect () const |
Returns the bounding rectangle of the polygon, or QRectF(0,0,0,0) if the polygon is empty. | |
Q_GUI_EXPORT bool | containsPoint (const QPointF &pt, Qt::FillRule fillRule) const |
Q_GUI_EXPORT QPolygonF | united (const QPolygonF &r) const |
Q_GUI_EXPORT QPolygonF | intersected (const QPolygonF &r) const |
Q_GUI_EXPORT QPolygonF | subtracted (const QPolygonF &r) const |
Q_GUI_EXPORT bool | intersects (const QPolygonF &r) const |
![]() | |
DataPointer & | data_ptr () & |
const DataPointer & | data_ptr () const & |
DataPointer && | data_ptr () && |
QList (DataPointer dd) noexcept | |
constexpr | QList () noexcept=default |
QList (qsizetype size) | |
QList (qsizetype size, parameter_type t) | |
QList (std::initializer_list< QPointF > args) | |
QList (InputIterator i1, InputIterator i2) | |
QList (const String &str) | |
QList (qsizetype size, Qt::Initialization) | |
QList< QPointF > & | operator= (std::initializer_list< QPointF > args) |
void | swap (QList &other) noexcept |
QTypeTraits::compare_eq_result_container< QList, U > | operator== (const QList &other) const |
QTypeTraits::compare_eq_result_container< QList, U > | operator!= (const QList &other) const |
QTypeTraits::compare_lt_result_container< QList, U > | operator< (const QList &other) const noexcept(noexcept(std::lexicographical_compare< typename QList< U >::const_iterator, typename QList::const_iterator >(std::declval< QList< U > >().begin(), std::declval< QList< U > >().end(), other.begin(), other.end()))) |
QTypeTraits::compare_lt_result_container< QList, U > | operator> (const QList &other) const noexcept(noexcept(other< std::declval< QList< U > >())) |
QTypeTraits::compare_lt_result_container< QList, U > | operator<= (const QList &other) const noexcept(noexcept(other< std::declval< QList< U > >())) |
QTypeTraits::compare_lt_result_container< QList, U > | operator>= (const QList &other) const noexcept(noexcept(std::declval< QList< U > >()< other)) |
constexpr qsizetype | size () const noexcept |
constexpr qsizetype | count () const noexcept |
qsizetype | count (const AT &t) const noexcept |
constexpr qsizetype | length () const noexcept |
constexpr bool | isEmpty () const noexcept |
void | resize (qsizetype size) |
void | resize (qsizetype size, parameter_type c) |
void | resizeForOverwrite (qsizetype size) |
qsizetype | capacity () const |
void | reserve (qsizetype size) |
void | squeeze () |
void | detach () |
bool | isDetached () const noexcept |
bool | isSharedWith (const QList< QPointF > &other) const |
pointer | data () |
const_pointer | data () const noexcept |
const_pointer | constData () const noexcept |
void | clear () |
const_reference | at (qsizetype i) const noexcept |
reference | operator[] (qsizetype i) |
const_reference | operator[] (qsizetype i) const noexcept |
void | append (parameter_type t) |
void | append (const_iterator i1, const_iterator i2) |
void | append (rvalue_ref t) |
void | append (const QList< QPointF > &l) |
void | append (QList< QPointF > &&l) |
void | prepend (rvalue_ref t) |
void | prepend (parameter_type t) |
reference | emplaceBack (Args &&... args) |
reference | emplaceFront (Args &&... args) |
iterator | insert (qsizetype i, parameter_type t) |
iterator | insert (qsizetype i, qsizetype n, parameter_type t) |
iterator | insert (const_iterator before, parameter_type t) |
iterator | insert (const_iterator before, qsizetype n, parameter_type t) |
iterator | insert (const_iterator before, rvalue_ref t) |
iterator | insert (qsizetype i, rvalue_ref t) |
QList & | assign (qsizetype n, parameter_type t) |
QList & | assign (InputIterator first, InputIterator last) |
QList & | assign (std::initializer_list< QPointF > l) |
iterator | emplace (const_iterator before, Args &&... args) |
iterator | emplace (qsizetype i, Args &&... args) |
void | replace (qsizetype i, parameter_type t) |
void | replace (qsizetype i, rvalue_ref t) |
void | remove (qsizetype i, qsizetype n=1) |
void | removeFirst () noexcept |
void | removeLast () noexcept |
value_type | takeFirst () |
value_type | takeLast () |
QList< QPointF > & | fill (parameter_type t, qsizetype size=-1) |
void | removeAt (qsizetype i) |
qsizetype | removeAll (const AT &t) |
bool | removeOne (const AT &t) |
qsizetype | removeIf (Predicate pred) |
QPointF | takeAt (qsizetype i) |
void | move (qsizetype from, qsizetype to) |
iterator | begin () |
const_iterator | begin () const noexcept |
iterator | end () |
const_iterator | end () const noexcept |
const_iterator | cbegin () const noexcept |
const_iterator | cend () const noexcept |
const_iterator | constBegin () const noexcept |
const_iterator | constEnd () const noexcept |
reverse_iterator | rbegin () |
const_reverse_iterator | rbegin () const noexcept |
reverse_iterator | rend () |
const_reverse_iterator | rend () const noexcept |
const_reverse_iterator | crbegin () const noexcept |
const_reverse_iterator | crend () const noexcept |
iterator | erase (const_iterator begin, const_iterator end) |
iterator | erase (const_iterator pos) |
QPointF & | first () |
const QPointF & | first () const noexcept |
QList< QPointF > | first (qsizetype n) const |
const QPointF & | constFirst () const noexcept |
QPointF & | last () |
const QPointF & | last () const noexcept |
QList< QPointF > | last (qsizetype n) const |
const QPointF & | constLast () const noexcept |
bool | startsWith (parameter_type t) const |
bool | endsWith (parameter_type t) const |
QList< QPointF > | mid (qsizetype pos, qsizetype len=-1) const |
QList< QPointF > | sliced (qsizetype pos) const |
QList< QPointF > | sliced (qsizetype pos, qsizetype n) const |
QPointF | value (qsizetype i) const |
QPointF | value (qsizetype i, parameter_type defaultValue) const |
void | swapItemsAt (qsizetype i, qsizetype j) |
void | push_back (parameter_type t) |
void | push_back (rvalue_ref t) |
void | push_front (rvalue_ref t) |
void | push_front (parameter_type t) |
void | pop_back () noexcept |
void | pop_front () noexcept |
reference | emplace_back (Args &&... args) |
bool | empty () const noexcept |
reference | front () |
const_reference | front () const noexcept |
reference | back () |
const_reference | back () const noexcept |
void | shrink_to_fit () |
constexpr qsizetype | max_size () const noexcept |
QList< QPointF > & | operator+= (const QList< QPointF > &l) |
QList< QPointF > & | operator+= (QList< QPointF > &&l) |
QList< QPointF > & | operator+= (parameter_type t) |
QList< QPointF > & | operator+= (rvalue_ref t) |
QList< QPointF > | operator+ (const QList< QPointF > &l) const & |
QList< QPointF > | operator+ (const QList< QPointF > &l) && |
QList< QPointF > | operator+ (QList< QPointF > &&l) const & |
QList< QPointF > | operator+ (QList< QPointF > &&l) && |
QList< QPointF > & | operator<< (parameter_type t) |
QList< QPointF > & | operator<< (const QList< QPointF > &l) |
QList< QPointF > & | operator<< (QList< QPointF > &&l) |
QList< QPointF > & | operator<< (rvalue_ref t) |
QList< QPointF > | toList () const noexcept |
QList< QPointF > | toVector () const noexcept |
![]() | |
qsizetype | indexOf (const AT &t, qsizetype from=0) const noexcept |
qsizetype | lastIndexOf (const AT &t, qsizetype from=-1) const noexcept |
bool | contains (const AT &t) const noexcept |
Related Symbols | |
(Note that these are not member symbols.) | |
QDataStream & | operator<< (QDataStream &stream, const QPolygonF &polygon) |
Writes the given polygon to the given stream, and returns a reference to the stream. | |
QDataStream & | operator>> (QDataStream &stream, QPolygonF &polygon) |
Reads a polygon from the given stream into the given polygon, and returns a reference to the stream. | |
Additional Inherited Members | |
![]() | |
using | Type |
using | value_type |
using | pointer |
using | const_pointer |
using | reference |
using | const_reference |
using | size_type |
using | difference_type |
using | parameter_type |
using | rvalue_ref |
using | Iterator |
using | ConstIterator |
using | reverse_iterator |
using | const_reverse_iterator |
![]() | |
static constexpr qsizetype | maxSize () |
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 |
![]() | |
using | Self |
![]() | |
QListSpecialMethods ()=default | |
![]() | |
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 95 of file qpolygon.h.
|
default |
Constructs a polygon with no points.
|
inline |
Constructs a polygon containing the specified points.
Definition at line 100 of file qpolygon.h.
|
inlinenoexcept |
Definition at line 101 of file qpolygon.h.
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.
Definition at line 489 of file qpolygon.cpp.
QPolygonF::QPolygonF | ( | const QPolygon & | polygon | ) |
Constructs a float based polygon from the specified integer based polygon.
Definition at line 508 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 583 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 731 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 892 of file qpolygon.cpp.
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.
Definition at line 929 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 116 of file qpolygon.h.
QPolygonF::operator QVariant | ( | ) | const |
Returns the polygon as a QVariant.
Definition at line 941 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 910 of file qpolygon.cpp.
Definition at line 104 of file qpolygon.h.
QPolygon QPolygonF::toPolygon | ( | ) | const |
Creates and returns a QPolygon by converting each QPointF to a QPoint.
Definition at line 614 of file qpolygon.cpp.
Translate all points in the polygon by the given offset.
Definition at line 521 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 144 of file qpolygon.h.
Returns a copy of the polygon that is translated by the given offset.
Definition at line 549 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 147 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 873 of file qpolygon.cpp.
|
Writes the given polygon to the given stream, and returns a reference to the stream.
|
Reads a polygon from the given stream into the given polygon, and returns a reference to the stream.