QPolygonF 类

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

头: #include <QPolygonF>
qmake: QT += gui
继承: QVector

注意: 此类的所有函数 可重入 .

公共函数

QPolygonF ()
QPolygonF (int size )
QPolygonF (const QVector<QPointF> & points )
QPolygonF (QVector<QPointF> && v )
QPolygonF (const QRectF & rectangle )
QPolygonF (const QPolygon & polygon )
QPolygonF (const QPolygonF & polygon )
QPolygonF (QPolygonF && other )
~QPolygonF ()
QRectF boundingRect () const
bool containsPoint (const QPointF & point , Qt::FillRule fillRule ) const
QPolygonF intersected (const QPolygonF & r ) const
bool isClosed () const
QPolygonF subtracted (const QPolygonF & r ) 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 & r ) const
operator QVariant () const
QPolygonF & operator= (QPolygonF && other )
QPolygonF & operator= (const QPolygonF & other )
QDataStream & operator<< (QDataStream & stream , const QPolygonF & polygon )
QDataStream & operator>> (QDataStream & stream , QPolygonF & polygon )

额外继承成员

  • 2 static public members inherited from QVector

详细描述

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

A QPolygonF QVector < QPointF >. The easiest way to add points to a QPolygonF is to use its 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 提供 boundingRect () 和 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.

QPolygonF class is 隐式共享 .

另请参阅 QVector , QPolygon ,和 QLineF .

成员函数文档编制

QPolygonF:: QPolygonF ()

Constructs a polygon with no points.

另请参阅 QVector::isEmpty ().

QPolygonF:: QPolygonF ( int size )

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

另请参阅 QVector::isEmpty ().

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

Constructs a polygon containing the specified points .

QPolygonF:: QPolygonF ( QVector < QPointF > && v )

Default constructs an instance of QPolygonF.

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.

另请参阅 isClosed ().

QPolygonF:: QPolygonF (const QPolygon & polygon )

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

另请参阅 toPolygon ().

QPolygonF:: QPolygonF (const QPolygonF & polygon )

构造副本为给定 polygon .

QPolygonF:: QPolygonF ( QPolygonF && other )

移动拷贝构造函数。

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.

另请参阅 QVector::isEmpty ().

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

返回 true 若给定 point is inside the polygon according to the specified fillRule ;否则返回 false .

该函数在 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.

该函数在 Qt 4.3 引入。

bool QPolygonF:: isClosed () const

返回 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.

另请参阅 QVector::first () 和 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.

该函数在 Qt 4.3 引入。

void QPolygonF:: swap ( QPolygonF & other )

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

该函数在 Qt 4.8 引入。

QPolygon QPolygonF:: toPolygon () const

创建和返回 QPolygon by converting each QPointF QPoint .

另请参阅 QPointF::toPoint ().

void QPolygonF:: translate (const QPointF & offset )

Translate all points in the polygon by the given offset .

另请参阅 translated ().

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

这是重载函数。

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

另请参阅 translated ().

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

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

该函数在 Qt 4.6 引入。

另请参阅 translate ().

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

这是重载函数。

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

该函数在 Qt 4.6 引入。

另请参阅 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.

该函数在 Qt 4.3 引入。

另请参阅 intersected () 和 subtracted ().

QPolygonF:: operator QVariant () const

Returns the polygon as a QVariant .

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

移动赋值运算符。

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

Copy-assignment operator.

相关非成员

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

写入给定 polygon 到给定 stream ,并返回流引用。

另请参阅 序列化 Qt 数据类型 .

QDataStream & operator>> ( QDataStream & stream , QPolygonF & polygon )

Reads a polygon from the given stream 进给定 polygon ,并返回流引用。

另请参阅 序列化 Qt 数据类型 .