PySide6.QtGui.QPolygonF¶
- class QPolygonF¶
The
QPolygonF
class provides a list of points using floating point precision. More…Synopsis¶
Methods¶
def
__init__()
def
append()
def
at()
def
back()
def
boundingRect()
def
capacity()
def
clear()
def
constData()
def
constFirst()
def
constLast()
def
containsPoint()
def
count()
def
data()
def
empty()
def
first()
def
front()
def
insert()
def
intersected()
def
intersects()
def
isClosed()
def
isEmpty()
def
isSharedWith()
def
last()
def
length()
def
max_size()
def
mid()
def
move()
def
__mul__()
def
__add__()
def
operator[]()
def
pop_back()
def
pop_front()
def
prepend()
def
push_back()
def
push_front()
def
remove()
def
removeAll()
def
removeAt()
def
removeFirst()
def
removeLast()
def
removeOne()
def
reserve()
def
resize()
def
shrink_to_fit()
def
size()
def
sliced()
def
squeeze()
def
subtracted()
def
swap()
def
swapItemsAt()
def
takeAt()
def
toList()
def
toPolygon()
def
toVector()
def
translate()
def
translated()
def
united()
def
value()
Static functions¶
def
fromList()
def
fromVector()
def
maxSize()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description¶
Warning
This section contains snippets that were automatically translated from C++ to Python and may contain errors.
A
QPolygonF
is a QList<QPointF>. The easiest way to add points to aQPolygonF
is to use its streaming operator, as illustrated below:polygon = QPolygonF() polygon << QPointF(10.4, 20.5) << QPointF(20.2, 30.2)
In addition to the functions provided by QList,
QPolygonF
provides theboundingRect()
andtranslate()
functions for geometry operations. Use themap()
function for more general transformations of QPolygonFs.QPolygonF
also provides theisClosed()
function to determine whether a polygon’s start and end points are the same, and thetoPolygon()
function returning an integer precision copy of this polygon.The
QPolygonF
class is implicitly shared.- __init__()¶
Constructs a polygon with no points.
See also
isEmpty()
- __init__(v)
- Parameters:
v – .list of QPointF
Constructs a polygon containing the specified
points
.- __init__(a)
- Parameters:
a –
QPolygon
Constructs a float based polygon from the specified integer based
polygon
.See also
- __init__(r)
- Parameters:
r –
QRectF
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
- append(l)
- Parameters:
l – .list of QPointF
Returns the bounding rectangle of the polygon, or QRectF(0,0,0,0) if the polygon is empty.
See also
isEmpty()
- capacity()¶
- Return type:
int
- clear()¶
Returns
true
if the givenpoint
is inside the polygon according to the specifiedfillRule
; otherwise returnsfalse
.- count()¶
- Return type:
int
- empty()¶
- Return type:
bool
- first(n)
- Parameters:
n – int
- Return type:
.list of QPointF
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.
See also
Returns
true
if the current polygon intersects at any point the given polygonp
. Also returnstrue
if the current polygon contains or is contained by any part ofp
.Set operations on polygons will treat the polygons as areas. Non-closed polygons will be treated as implicitly closed.
See also
- isClosed()¶
- Return type:
bool
Returns
true
if the polygon is closed; otherwise returnsfalse
.A polygon is said to be closed if its start point and end point are equal.
See also
last()
- isEmpty()¶
- Return type:
bool
- Parameters:
other – .list of QPointF
- Return type:
bool
- last(n)
- Parameters:
n – int
- Return type:
.list of QPointF
- length()¶
- Return type:
int
- static maxSize()¶
- Return type:
int
- max_size()¶
- Return type:
int
- move(from, to)¶
- Parameters:
from – int
to – int
- __mul__(m)¶
- Parameters:
m –
QTransform
- Return type:
- pop_back()¶
- pop_front()¶
- remove(i[, n=1])¶
- Parameters:
i – int
n – int
- removeAt(i)¶
- Parameters:
i – int
- removeFirst()¶
- removeLast()¶
- reserve(size)¶
- Parameters:
size – int
- resize(size)¶
- Parameters:
size – int
- resizeForOverwrite(size)¶
- Parameters:
size – int
- shrink_to_fit()¶
- size()¶
- Return type:
int
- sliced(pos, n)
- Parameters:
pos – int
n – int
- Return type:
.list of QPointF
- squeeze()¶
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.
Swaps polygon
other
with this polygon. This operation is very fast and never fails.- swapItemsAt(i, j)¶
- Parameters:
i – int
j – int
Creates and returns a
QPolygon
by converting each QPointF to a QPoint.See also
Translate all points in the polygon by the given
offset
.See also
- translate(dx, dy)
- Parameters:
dx – float
dy – float
This is an overloaded function.
Translates all points in the polygon by (
dx
,dy
).See also
Returns a copy of the polygon that is translated by the given
offset
.See also
- translated(dx, dy)
- Parameters:
dx – float
dy – float
- Return type:
This is an overloaded function.
Returns a copy of the polygon that is translated by (
dx
,dy
).See also
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.
See also