CopperSpice API  1.7.2
QPolygonF Class Reference

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

Inheritance diagram for QPolygonF:
QVector< QPointF >

Public Methods

 QPolygonF ()
 
 QPolygonF (const QPolygon &polygon)
 
 QPolygonF (const QPolygonF &other)
 
 QPolygonF (const QRectF &rectangle)
 
 QPolygonF (const QVector< QPointF > &points)
 
 QPolygonF (int size)
 
 QPolygonF (QPolygonF &&other)
 
 QPolygonF (QVector< QPointF > &&points)
 
 ~QPolygonF ()
 
QRectF boundingRect () const
 
bool containsPoint (const QPointF &pt, Qt::FillRule fillRule) const
 
QPolygonF intersected (const QPolygonF &rectangle) const
 
bool isClosed () const
 
 operator QVariant () const
 
QPolygonF & operator= (const QPolygonF &other)
 
QPolygonF & operator= (QPolygonF &&other)
 
QPolygonF subtracted (const QPolygonF &rectangle) const
 
void swap (QPolygonF &other)
 
QPolygon toPolygon () const
 
void translate (const QPointF &offset)
 
void translate (qreal dx, qreal dy)
 
QPolygonF translated (const QPointF &offset) const
 
QPolygonF translated (qreal dx, qreal dy) const
 
QPolygonF united (const QPolygonF &rectangle) const
 
- Public Methods inherited from QVector< QPointF >
 QVector () = default
 
 QVector (const QVector< QPointF > &other) = default
 
 QVector (Input_Iterator first, Input_Iterator last)
 
 QVector (QVector< QPointF > &&other) = default
 
 QVector (size_type size)
 
 QVector (size_type size, const QPointF &value)
 
 QVector (std::initializer_list< QPointF > args)
 
 ~QVector () = default
 
void append (const QPointF &value)
 
void append (const QVector< QPointF > &other)
 
void append (Iter begin, Iter end)
 
void append (QPointF &&value)
 
const_reference at (size_type i) const
 
reference back ()
 
const_reference back () const
 
iterator begin ()
 
const_iterator begin () const
 
size_type capacity () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
void clear ()
 
const_iterator constBegin () const
 
const QPointFconstData () const
 
const_iterator constEnd () const
 
const_reference constFirst () const
 
const_reference constLast () const
 
bool contains (const QPointF &value) const
 
size_type count () const
 
size_type count (const QPointF &value) const
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator crend () const
 
QPointFdata ()
 
const QPointFdata () const
 
bool empty () const
 
iterator end ()
 
const_iterator end () const
 
bool endsWith (const QPointF &value) const
 
iterator erase (const_iterator begin, const_iterator end)
 
iterator erase (const_iterator pos)
 
QVector< QPointF > & fill (const QPointF &value, size_type newSize=-1)
 
reference first ()
 
const_reference first () const
 
reference front ()
 
const_reference front () const
 
size_type indexOf (const QPointF &value, size_type from=0) const
 
iterator insert (iterator before, const QPointF &value)
 
iterator insert (iterator before, size_type count, const QPointF &value)
 
iterator insert (iterator pos, Iter begin, Iter end)
 
void insert (size_type pos, const QPointF &value)
 
void insert (size_type pos, size_type count, const QPointF &value)
 
bool isEmpty () const
 
reference last ()
 
const_reference last () const
 
size_type lastIndexOf (const QPointF &value, size_type from=-1) const
 
size_type length () const
 
QVector< QPointFmid (size_type pos, size_type length=-1) const
 
void move (size_type from, size_type to)
 
bool operator!= (const QVector< QPointF > &other) const
 
QVector< QPointFoperator+ (const QVector< QPointF > &other) const
 
QVector< QPointF > & operator+= (const QPointF &value)
 
QVector< QPointF > & operator+= (const QVector< QPointF > &other)
 
QVector< QPointF > & operator<< (const QPointF &value)
 
QVector< QPointF > & operator<< (const QVector< QPointF > &other)
 
QVector< QPointF > & operator= (const QVector< QPointF > &other) = default
 
QVector< QPointF > & operator= (QVector< QPointF > &&other) = default
 
bool operator== (const QVector< QPointF > &other) const
 
reference operator[] (size_type i)
 
const_reference operator[] (size_type i) const
 
void pop_back ()
 
void pop_front ()
 
void prepend (const QPointF &value)
 
void push_back (const QPointF &value)
 
void push_back (QPointF &&value)
 
void push_front (const QPointF &value)
 
void push_front (QPointF &&value)
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
void remove (size_type pos)
 
void remove (size_type pos, size_type count)
 
size_type removeAll (const QPointF &value)
 
void removeAt (size_type pos)
 
void removeFirst ()
 
void removeLast ()
 
bool removeOne (const QPointF &value)
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
void replace (size_type i, const QPointF &value)
 
void reserve (size_type size)
 
void resize (size_type size)
 
size_type size () const
 
void squeeze ()
 
bool startsWith (const QPointF &value) const
 
void swap (QVector< QPointF > &other)
 
QPointF takeAt (size_type i)
 
QPointF takeFirst ()
 
QPointF takeLast ()
 
QList< QPointFtoList () const
 
std::vector< QPointFtoStdVector () const
 
QPointF value (size_type i) const
 
QPointF value (size_type i, const QPointF &defaultValue) const
 

Related Functions

These are not member functions

QDataStreamoperator<< (QDataStream &stream, const QPolygonF &polygon)
 
QDataStreamoperator>> (QDataStream &stream, QPolygonF &polygon)
 

Additional Inherited Members

- Public Typedefs inherited from QVector< QPointF >
using allocator_type = typename std::vector< QPointF >::allocator_type
 
using const_iterator = typename std::vector< QPointF >::const_iterator
 
using const_pointer = typename std::vector< QPointF >::const_pointer
 
using const_reference = typename std::vector< QPointF >::const_reference
 
using const_reverse_iterator = typename std::vector< QPointF >::const_reverse_iterator
 
using difference_type = typename std::vector< QPointF >::difference_type
 
using iterator = typename std::vector< QPointF >::iterator
 
using Java_Iterator = QVectorIterator< QPointF >
 
using Java_MutableIterator = QMutableVectorIterator< QPointF >
 
using pointer = typename std::vector< QPointF >::pointer
 
using reference = typename std::vector< QPointF >::reference
 
using reverse_iterator = typename std::vector< QPointF >::reverse_iterator
 
using size_type = typename std::vector< QPointF >::difference_type
 
using value_type = typename std::vector< QPointF >::value_type
 
- Static Public Methods inherited from QVector< QPointF >
static QVector< QPointFfromList (const QList< QPointF > &list)
 
static QVector< QPointFfromStdVector (const std::vector< QPointF > &vector)
 

Detailed Description

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

A QPolygonF is a QVector<QPointF>. The easiest way to add points to a QPolygonF is to use the streaming operator, as illustrated below.

QPolygonF polygon;
polygon << QPointF(10.4, 20.5) << QPointF(20.2, 30.2);

In addition to the functions provided by QVector, QPolygonF provides the boundingRect() and translate() functions for geometry operations. Use the QMatrix::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 implicit-sharing-c "implicitly shared".

See also
QVector, QPolygon, QLineF

Constructor & Destructor Documentation

QPolygonF::QPolygonF ( )
inline

Constructs a polygon with no points.

See also
QVector::isEmpty()
QPolygonF::QPolygonF ( int  asize)
inlineexplicit

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

See also
QVector::isEmpty()
QPolygonF::QPolygonF ( const QPolygonF &  other)
inline

Constructs a copy of other.

QPolygonF::QPolygonF ( QPolygonF &&  other)
inline

Move constructs a copy of other.

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

Constructs a polygon containing the specified points.

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

Move constructs a polygon containing the specified points.

See also
setPoints()
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 QPolygon polygon)

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

See also
toPolygon()
QPolygonF::~QPolygonF ( )
inline

Destroys the polygon.

Method Documentation

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.

QPolygonF QPolygonF::intersected ( const QPolygonF &  rectangle) const

Returns a polygon which is the intersection of this polygon and rectangle. Set operations on polygons will treat the polygons as areas. Non-closed polygons will be treated as implicitly closed.

bool QPolygonF::isClosed ( ) const
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.

See also
QVector::first(), QVector::last()
QPolygonF::operator QVariant ( ) const

Returns the polygon as a QVariant.

QPolygonF & QPolygonF::operator= ( const QPolygonF &  other)
inline

Copy assigns from other and returns a reference to this object.

QPolygonF & QPolygonF::operator= ( QPolygonF &&  other)
inline

Move assigns from other and returns a reference to this object.

QPolygonF QPolygonF::subtracted ( const QPolygonF &  rectangle) const

Returns a polygon which is rectangle subtracted from this polygon.

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

void QPolygonF::swap ( QPolygonF &  other)
inline

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

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 
)
inline

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.

See also
translate()
QPolygonF QPolygonF::translated ( qreal  dx,
qreal  dy 
) const
inline

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

See also
translate()
QPolygonF QPolygonF::united ( const QPolygonF &  rectangle) const

Returns a polygon which is the union of this polygon and rectangle. Set operations on polygons will treat the polygons as areas. Non-closed polygons will be treated as implicitly closed.

See also
intersected(), subtracted()

Friends And Related Function Documentation

QDataStream & operator<< ( QDataStream stream,
const QPolygonF &  polygon 
)
related

Writes the given polygon to the given stream, and returns a reference to the stream.

See also
Refer to Serializing Data Types for additional information
QDataStream & operator>> ( QDataStream stream,
QPolygonF &  polygon 
)
related

Reads a polygon from the given stream into the given polygon, and returns a reference to the stream.

See also
Refer to Serializing Data Types for additional information