 Home · All Classes · Modules

QPolygonF Class Reference[QtGui module]

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

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 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 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 implicitly shared.

Method Documentation

QPolygonF.__init__ (self)

Constructs a polygon with no points.

QPolygonF.__init__ (self, QPolygonFa)

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

QPolygonF.__init__ (self, list-of-QPointF v)

Constructs a copy of the given polygon.

QPolygonF.__init__ (self, QRectFr)

Constructs a polygon containing the specified points.

QPolygonF.__init__ (self, QPolygona)

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.

QPolygonF.__init__ (self, int asize)

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

QRectF QPolygonF.boundingRect (self)

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

bool QPolygonF.containsPoint (self, QPointFpt, Qt.FillRulefillRule)

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 (self, QPolygonFr)

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.

bool QPolygonF.isClosed (self)

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.

QPolygonF QPolygonF.subtracted (self, QPolygonFr)

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.

QPolygonF.swap (self, QPolygonFother)

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 (self)

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

QPolygonF.translate (self, QPointFoffset)

Translate all points in the polygon by the given offset.

QPolygonF.translate (self, float dx, float dy)

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

QPolygonF QPolygonF.translated (self, QPointFoffset)

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

This function was introduced in Qt 4.6.

QPolygonF QPolygonF.translated (self, float dx, float dy)

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

This function was introduced in Qt 4.6.

QPolygonF QPolygonF.united (self, QPolygonFr)

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.

QPolygonF.__setitem__ (self, slice slice, QPolygonFlist)

 PyQt 4.9.4 for Windows Copyright © Riverbank Computing Ltd and Nokia 2012 Qt 4.8.2