QPolygon#
The QPolygon
class provides a list of points using integer precision. More…
Synopsis#
Functions#
def
__reduce__
()def
append
(arg__1)def
append
(l)def
at
(i)def
back
()def
boundingRect
()def
capacity
()def
clear
()def
constData
()def
constFirst
()def
constLast
()def
containsPoint
(pt, fillRule)def
count
()def
data
()def
empty
()def
first
()def
first
(n)def
front
()def
insert
(arg__1, arg__2)def
intersected
(r)def
intersects
(r)def
isEmpty
()def
isSharedWith
(other)def
last
()def
last
(n)def
length
()def
mid
(pos[, len=-1])def
move
(from, to)def
__ne__
(arg__1)def
__mul__
(m)def
__add__
(l)def
__lshift__
(arg__1)def
__lshift__
(arg__1)def
__eq__
(arg__1)def
operator[]
(i)def
pop_back
()def
pop_front
()def
prepend
(arg__1)def
push_back
(arg__1)def
push_front
(arg__1)def
remove
(i[, n=1])def
removeAll
(arg__1)def
removeAt
(i)def
removeFirst
()def
removeLast
()def
removeOne
(arg__1)def
reserve
(size)def
resize
(size)def
shrink_to_fit
()def
size
()def
sliced
(pos)def
sliced
(pos, n)def
squeeze
()def
subtracted
(r)def
swap
(other)def
swapItemsAt
(i, j)def
takeAt
(i)def
toList
()def
toPolygonF
()def
toVector
()def
translate
(offset)def
translate
(dx, dy)def
translated
(offset)def
translated
(dx, dy)def
united
(r)def
value
(i)
Static functions#
def
fromList
(list)def
fromVector
(vector)
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 QPolygon
object is a QList
< QPoint
>. The easiest way to add points to a QPolygon
is to use QList
‘s streaming operator, as illustrated below:
polygon = QPolygon() polygon << QPoint(10, 20) << QPoint(20, 30)
In addition to the functions provided by QList
, QPolygon
provides some point-specific functions.
Each point in a polygon can be retrieved by passing its index to the point()
function. To populate the polygon, QPolygon
provides the setPoint()
function to set the point at a given index, the setPoints()
function to set all the points in the polygon (resizing it to the given number of points), and the putPoints()
function which copies a number of given points into the polygon from a specified index (resizing the polygon if necessary).
QPolygon
provides the boundingRect()
and translate()
functions for geometry functions. Use the map()
function for more general transformations of QPolygons.
The QPolygon
class is implicitly shared .
See also
QList
QPolygonF
QLine
- class PySide6.QtGui.QPolygon#
PySide6.QtGui.QPolygon(v)
PySide6.QtGui.QPolygon(r[, closed=false])
- Parameters:
closed – bool
v –
Constructs a polygon with no points.
See also
isEmpty()
Constructs a polygon containing the specified points
.
See also
setPoints()
Constructs a polygon from the given rectangle
. If closed
is false, the polygon just contains the four points of the rectangle ordered clockwise, otherwise the polygon’s fifth point is set to rectangle
. topLeft() .
Note that the bottom-right corner of the rectangle is located at (rectangle.x() + rectangle. width() , rectangle.y() + rectangle. height() ).
See also
setPoints()
- PySide6.QtGui.QPolygon.__reduce__()#
- Return type:
object
- PySide6.QtGui.QPolygon.append(arg__1)#
- Parameters:
arg__1 –
PySide6.QtCore.QPoint
- PySide6.QtGui.QPolygon.append(l)
- Parameters:
l –
- PySide6.QtGui.QPolygon.at(i)#
- Parameters:
i –
qsizetype
- Return type:
- PySide6.QtGui.QPolygon.back()#
- Return type:
- PySide6.QtGui.QPolygon.boundingRect()#
- Return type:
Returns the bounding rectangle of the polygon, or QRect
(0, 0, 0, 0) if the polygon is empty.
See also
isEmpty()
- PySide6.QtGui.QPolygon.capacity()#
- Return type:
qsizetype
- PySide6.QtGui.QPolygon.clear()#
- PySide6.QtGui.QPolygon.constData()#
- Return type:
- PySide6.QtGui.QPolygon.constFirst()#
- Return type:
- PySide6.QtGui.QPolygon.constLast()#
- Return type:
- PySide6.QtGui.QPolygon.containsPoint(pt, fillRule)#
- Parameters:
fillRule –
FillRule
- Return type:
bool
Returns true
if the given point
is inside the polygon according to the specified fillRule
; otherwise returns false
.
- PySide6.QtGui.QPolygon.count()#
- Return type:
qsizetype
- PySide6.QtGui.QPolygon.data()#
- Return type:
- PySide6.QtGui.QPolygon.empty()#
- Return type:
bool
- PySide6.QtGui.QPolygon.first()#
- Return type:
- PySide6.QtGui.QPolygon.first(n)
- Parameters:
n –
qsizetype
- Return type:
- static PySide6.QtGui.QPolygon.fromList(list)#
- Parameters:
list –
- Return type:
- static PySide6.QtGui.QPolygon.fromVector(vector)#
- Parameters:
vector –
- Return type:
- PySide6.QtGui.QPolygon.front()#
- Return type:
- PySide6.QtGui.QPolygon.insert(arg__1, arg__2)#
- Parameters:
arg__1 –
qsizetype
arg__2 –
PySide6.QtCore.QPoint
- PySide6.QtGui.QPolygon.intersected(r)#
- Parameters:
- Return type:
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
- PySide6.QtGui.QPolygon.intersects(r)#
- Parameters:
- Return type:
bool
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.
See also
- PySide6.QtGui.QPolygon.isEmpty()#
- Return type:
bool
- Parameters:
other –
- Return type:
bool
- PySide6.QtGui.QPolygon.last()#
- Return type:
- PySide6.QtGui.QPolygon.last(n)
- Parameters:
n –
qsizetype
- Return type:
- PySide6.QtGui.QPolygon.length()#
- Return type:
qsizetype
- PySide6.QtGui.QPolygon.mid(pos[, len=-1])#
- Parameters:
pos –
qsizetype
len –
qsizetype
- Return type:
- PySide6.QtGui.QPolygon.move(from, to)#
- Parameters:
from –
qsizetype
to –
qsizetype
- PySide6.QtGui.QPolygon.__ne__(arg__1)#
- Parameters:
arg__1 –
PySide6.QtGui.QPolygon
- Return type:
bool
- PySide6.QtGui.QPolygon.__mul__(m)#
- Parameters:
- Return type:
- PySide6.QtGui.QPolygon.__add__(l)#
- Parameters:
l –
- Return type:
- PySide6.QtGui.QPolygon.__lshift__(arg__1)#
- Parameters:
arg__1 –
PySide6.QtCore.QPoint
- PySide6.QtGui.QPolygon.__lshift__(arg__1)
- Parameters:
arg__1 –
- PySide6.QtGui.QPolygon.__eq__(arg__1)#
- Parameters:
arg__1 –
PySide6.QtGui.QPolygon
- Return type:
bool
- PySide6.QtGui.QPolygon.operator[](i)
- Parameters:
i –
qsizetype
- Return type:
- PySide6.QtGui.QPolygon.pop_back()#
- PySide6.QtGui.QPolygon.pop_front()#
- PySide6.QtGui.QPolygon.prepend(arg__1)#
- Parameters:
arg__1 –
PySide6.QtCore.QPoint
- PySide6.QtGui.QPolygon.push_back(arg__1)#
- Parameters:
arg__1 –
PySide6.QtCore.QPoint
- PySide6.QtGui.QPolygon.push_front(arg__1)#
- Parameters:
arg__1 –
PySide6.QtCore.QPoint
- PySide6.QtGui.QPolygon.remove(i[, n=1])#
- Parameters:
i –
qsizetype
n –
qsizetype
- PySide6.QtGui.QPolygon.removeAll(arg__1)#
- Parameters:
arg__1 –
PySide6.QtCore.QPoint
- PySide6.QtGui.QPolygon.removeAt(i)#
- Parameters:
i –
qsizetype
- PySide6.QtGui.QPolygon.removeFirst()#
- PySide6.QtGui.QPolygon.removeLast()#
- PySide6.QtGui.QPolygon.removeOne(arg__1)#
- Parameters:
arg__1 –
PySide6.QtCore.QPoint
- PySide6.QtGui.QPolygon.reserve(size)#
- Parameters:
size –
qsizetype
- PySide6.QtGui.QPolygon.resize(size)#
- Parameters:
size –
qsizetype
- PySide6.QtGui.QPolygon.shrink_to_fit()#
- PySide6.QtGui.QPolygon.size()#
- Return type:
qsizetype
- PySide6.QtGui.QPolygon.sliced(pos)#
- Parameters:
pos –
qsizetype
- Return type:
- PySide6.QtGui.QPolygon.sliced(pos, n)
- Parameters:
pos –
qsizetype
n –
qsizetype
- Return type:
- PySide6.QtGui.QPolygon.squeeze()#
- PySide6.QtGui.QPolygon.subtracted(r)#
- Parameters:
- Return type:
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.
- PySide6.QtGui.QPolygon.swap(other)#
- Parameters:
other –
PySide6.QtGui.QPolygon
Swaps polygon other
with this polygon. This operation is very fast and never fails.
- PySide6.QtGui.QPolygon.swapItemsAt(i, j)#
- Parameters:
i –
qsizetype
j –
qsizetype
- PySide6.QtGui.QPolygon.takeAt(i)#
- Parameters:
i –
qsizetype
- Return type:
- PySide6.QtGui.QPolygon.toList()#
- Return type:
- PySide6.QtGui.QPolygon.toPolygonF()#
- Return type:
Returns this polygon as a polygon with floating point accuracy.
See also
- PySide6.QtGui.QPolygon.toVector()#
- Return type:
- PySide6.QtGui.QPolygon.translate(offset)#
- Parameters:
offset –
PySide6.QtCore.QPoint
This is an overloaded function.
Translates all points in the polygon by the given offset
.
See also
- PySide6.QtGui.QPolygon.translate(dx, dy)
- Parameters:
dx – int
dy – int
Translates all points in the polygon by (dx
, dy
).
See also
- PySide6.QtGui.QPolygon.translated(offset)#
- Parameters:
offset –
PySide6.QtCore.QPoint
- Return type:
This is an overloaded function.
Returns a copy of the polygon that is translated by the given offset
.
See also
- PySide6.QtGui.QPolygon.translated(dx, dy)
- Parameters:
dx – int
dy – int
- Return type:
Returns a copy of the polygon that is translated by (dx
, dy
).
See also
- PySide6.QtGui.QPolygon.united(r)#
- Parameters:
- Return type:
Returns a polygon which is the union of this polygon and r
.
Set operations on polygons, will treat the polygons as areas, and implicitly close the polygon.
See also
- PySide6.QtGui.QPolygon.value(i)#
- Parameters:
i –
qsizetype
- Return type: