QPolygon¶
Synopsis¶
Functions¶
def
__add__
(l)def
__eq__
(v)def
__iadd__
(t)def
__iadd__
(t)def
__lshift__
(l)def
__lshift__
(t)def
__lshift__
(t)def
__mul__
(, m)def
__mul__
(, m)def
__ne__
(v)def
__reduce__
()def
append
(l)def
append
(t)def
append
(t)def
at
(i)def
back
()def
boundingRect
()def
capacity
()def
clear
()def
constData
()def
constFirst
()def
constLast
()def
contains
(t)def
containsPoint
(pt, fillRule)def
count
()def
count
(t)def
data
()def
empty
()def
endsWith
(t)def
fill
(t[, size=-1])def
first
()def
front
()def
indexOf
(t[, from=0])def
insert
(i, n, t)def
insert
(i, t)def
insert
(i, t)def
intersected
(r)def
intersects
(r)def
isEmpty
()def
isSharedWith
(other)def
last
()def
lastIndexOf
(t[, from=-1])def
length
()def
mid
(pos[, len=-1])def
move
(from, to)def
operator[]
(i)def
pop_back
()def
pop_front
()def
prepend
(t)def
prepend
(t)def
push_back
(t)def
push_back
(t)def
push_front
(t)def
push_front
(t)def
remove
(i)def
remove
(i, n)def
removeAll
(t)def
removeAt
(i)def
removeFirst
()def
removeLast
()def
removeOne
(t)def
replace
(i, t)def
reserve
(size)def
resize
(size)def
setSharable
(sharable)def
shrink_to_fit
()def
size
()def
squeeze
()def
startsWith
(t)def
subtracted
(r)def
swap
(other)def
takeAt
(i)def
takeFirst
()def
takeLast
()def
toList
()def
translate
(dx, dy)def
translate
(offset)def
translated
(dx, dy)def
translated
(offset)def
united
(r)def
value
(i)def
value
(i, defaultValue)
Detailed Description¶
A
QPolygon
object is aQVector
<QPoint
>. The easiest way to add points to aQPolygon
is to useQVector
‘s streaming operator, as illustrated below:polygon = QPolygon() polygon << QPoint(10, 20) << QPoint(20, 30)In addition to the functions provided by
QVector
,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 thesetPoint()
function to set the point at a given index, thesetPoints()
function to set all the points in the polygon (resizing it to the given number of points), and theputPoints()
function which copies a number of given points into the polygon from a specified index (resizing the polygon if necessary).
QPolygon
provides theboundingRect()
andtranslate()
functions for geometry functions. Use themap()
function for more general transformations of QPolygons.The
QPolygon
class is implicitly shared .
-
class
QPolygon
¶ QPolygon(v)
QPolygon(other)
QPolygon(r[, closed=false])
QPolygon(v)
QPolygon(size)
- param closed
bool
- param size
int
- param other
- param r
QRect
- param v
QVector
Constructs a polygon with no points.
See also
isEmpty()
Constructs a polygon of the given
size
. Creates an empty polygon ifsize
== 0.See also
isEmpty()
-
PySide2.QtGui.QPolygon.
__reduce__
()¶ - Return type
PyObject
-
PySide2.QtGui.QPolygon.
append
(t)¶ - Parameters
t –
QPoint
-
PySide2.QtGui.QPolygon.
append
(t) - Parameters
t –
QPoint
-
PySide2.QtGui.QPolygon.
append
(l) - Parameters
l –
-
PySide2.QtGui.QPolygon.
at
(i)¶ - Parameters
i –
int
- Return type
QPoint
-
PySide2.QtGui.QPolygon.
back
()¶ - Return type
QPoint
-
PySide2.QtGui.QPolygon.
boundingRect
()¶ - Return type
QRect
Returns the bounding rectangle of the polygon, or
QRect
(0, 0, 0, 0) if the polygon is empty.See also
isEmpty()
-
PySide2.QtGui.QPolygon.
capacity
()¶ - Return type
int
-
PySide2.QtGui.QPolygon.
clear
()¶
-
PySide2.QtGui.QPolygon.
constData
()¶ - Return type
QPoint
-
PySide2.QtGui.QPolygon.
constFirst
()¶ - Return type
QPoint
-
PySide2.QtGui.QPolygon.
constLast
()¶ - Return type
QPoint
-
PySide2.QtGui.QPolygon.
contains
(t)¶ - Parameters
t –
QPoint
- Return type
bool
-
PySide2.QtGui.QPolygon.
containsPoint
(pt, fillRule)¶ - Parameters
pt –
QPoint
fillRule –
FillRule
- Return type
bool
Returns
true
if the givenpoint
is inside the polygon according to the specifiedfillRule
; otherwise returnsfalse
.
-
PySide2.QtGui.QPolygon.
count
()¶ - Return type
int
-
PySide2.QtGui.QPolygon.
count
(t) - Parameters
t –
QPoint
- Return type
int
-
PySide2.QtGui.QPolygon.
data
()¶ - Return type
QPoint
-
PySide2.QtGui.QPolygon.
empty
()¶ - Return type
bool
-
PySide2.QtGui.QPolygon.
endsWith
(t)¶ - Parameters
t –
QPoint
- Return type
bool
-
PySide2.QtGui.QPolygon.
fill
(t[, size=-1])¶ - Parameters
t –
QPoint
size –
int
- Return type
-
PySide2.QtGui.QPolygon.
first
()¶ - Return type
QPoint
-
static
PySide2.QtGui.QPolygon.
fromList
(list)¶ - Parameters
list –
- Return type
-
PySide2.QtGui.QPolygon.
front
()¶ - Return type
QPoint
-
PySide2.QtGui.QPolygon.
indexOf
(t[, from=0])¶ - Parameters
t –
QPoint
from –
int
- Return type
int
-
PySide2.QtGui.QPolygon.
insert
(i, t)¶ - Parameters
i –
int
t –
QPoint
-
PySide2.QtGui.QPolygon.
insert
(i, t) - Parameters
i –
int
t –
QPoint
-
PySide2.QtGui.QPolygon.
insert
(i, n, t) - Parameters
i –
int
n –
int
t –
QPoint
-
PySide2.QtGui.QPolygon.
intersected
(r)¶ -
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
-
PySide2.QtGui.QPolygon.
intersects
(r)¶ - Parameters
r –
QPolygon
- Return type
bool
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
-
PySide2.QtGui.QPolygon.
isEmpty
()¶ - Return type
bool
- Parameters
other –
- Return type
bool
-
PySide2.QtGui.QPolygon.
last
()¶ - Return type
QPoint
-
PySide2.QtGui.QPolygon.
lastIndexOf
(t[, from=-1])¶ - Parameters
t –
QPoint
from –
int
- Return type
int
-
PySide2.QtGui.QPolygon.
length
()¶ - Return type
int
-
PySide2.QtGui.QPolygon.
mid
(pos[, len=-1])¶ - Parameters
pos –
int
len –
int
- Return type
-
PySide2.QtGui.QPolygon.
move
(from, to)¶ - Parameters
from –
int
to –
int
-
PySide2.QtGui.QPolygon.
__ne__
(v)¶ - Parameters
v –
- Return type
bool
-
PySide2.QtGui.QPolygon.
__mul__
(m)¶ - Parameters
m –
QTransform
- Return type
-
PySide2.QtGui.QPolygon.
__add__
(l)¶ - Parameters
l –
- Return type
-
PySide2.QtGui.QPolygon.
__iadd__
(t)¶ - Parameters
t –
QPoint
- Return type
-
PySide2.QtGui.QPolygon.
__iadd__
(t) - Parameters
t –
QPoint
- Return type
-
PySide2.QtGui.QPolygon.
__lshift__
(t)¶ - Parameters
t –
QPoint
- Return type
-
PySide2.QtGui.QPolygon.
__lshift__
(t) - Parameters
t –
QPoint
- Return type
-
PySide2.QtGui.QPolygon.
__lshift__
(l) - Parameters
l –
- Return type
-
PySide2.QtGui.QPolygon.
__eq__
(v)¶ - Parameters
v –
- Return type
bool
-
PySide2.QtGui.QPolygon.operator[](i)
- Parameters
i –
int
- Return type
QPoint
-
PySide2.QtGui.QPolygon.
pop_back
()¶
-
PySide2.QtGui.QPolygon.
pop_front
()¶
-
PySide2.QtGui.QPolygon.
prepend
(t)¶ - Parameters
t –
QPoint
-
PySide2.QtGui.QPolygon.
prepend
(t) - Parameters
t –
QPoint
-
PySide2.QtGui.QPolygon.
push_back
(t)¶ - Parameters
t –
QPoint
-
PySide2.QtGui.QPolygon.
push_back
(t) - Parameters
t –
QPoint
-
PySide2.QtGui.QPolygon.
push_front
(t)¶ - Parameters
t –
QPoint
-
PySide2.QtGui.QPolygon.
push_front
(t) - Parameters
t –
QPoint
-
PySide2.QtGui.QPolygon.
remove
(i)¶ - Parameters
i –
int
-
PySide2.QtGui.QPolygon.
remove
(i, n) - Parameters
i –
int
n –
int
-
PySide2.QtGui.QPolygon.
removeAll
(t)¶ - Parameters
t –
QPoint
- Return type
int
-
PySide2.QtGui.QPolygon.
removeAt
(i)¶ - Parameters
i –
int
-
PySide2.QtGui.QPolygon.
removeFirst
()¶
-
PySide2.QtGui.QPolygon.
removeLast
()¶
-
PySide2.QtGui.QPolygon.
removeOne
(t)¶ - Parameters
t –
QPoint
- Return type
bool
-
PySide2.QtGui.QPolygon.
replace
(i, t)¶ - Parameters
i –
int
t –
QPoint
-
PySide2.QtGui.QPolygon.
reserve
(size)¶ - Parameters
size –
int
-
PySide2.QtGui.QPolygon.
resize
(size)¶ - Parameters
size –
int
-
PySide2.QtGui.QPolygon.
setSharable
(sharable)¶ - Parameters
sharable –
bool
-
PySide2.QtGui.QPolygon.
shrink_to_fit
()¶
-
PySide2.QtGui.QPolygon.
size
()¶ - Return type
int
-
PySide2.QtGui.QPolygon.
squeeze
()¶
-
PySide2.QtGui.QPolygon.
startsWith
(t)¶ - Parameters
t –
QPoint
- Return type
bool
-
PySide2.QtGui.QPolygon.
subtracted
(r)¶ -
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.
-
PySide2.QtGui.QPolygon.
swap
(other)¶ - Parameters
other –
QPolygon
Swaps polygon
other
with this polygon. This operation is very fast and never fails.
-
PySide2.QtGui.QPolygon.
takeAt
(i)¶ - Parameters
i –
int
- Return type
QPoint
-
PySide2.QtGui.QPolygon.
takeFirst
()¶ - Return type
QPoint
-
PySide2.QtGui.QPolygon.
takeLast
()¶ - Return type
QPoint
-
PySide2.QtGui.QPolygon.
toList
()¶ - Return type
-
PySide2.QtGui.QPolygon.
translate
(offset)¶ - Parameters
offset –
QPoint
This is an overloaded function.
Translates all points in the polygon by the given
offset
.See also
-
PySide2.QtGui.QPolygon.
translate
(dx, dy) - Parameters
dx –
int
dy –
int
Translates all points in the polygon by (
dx
,dy
).See also
-
PySide2.QtGui.QPolygon.
translated
(offset)¶ - Parameters
offset –
QPoint
- Return type
This is an overloaded function.
Returns a copy of the polygon that is translated by the given
offset
.See also
-
PySide2.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
-
PySide2.QtGui.QPolygon.
united
(r)¶ -
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
-
PySide2.QtGui.QPolygon.
value
(i)¶ - Parameters
i –
int
- Return type
QPoint
-
PySide2.QtGui.QPolygon.
value
(i, defaultValue) - Parameters
i –
int
defaultValue –
QPoint
- Return type
QPoint
© 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.