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
swapItemsAt
(i, j)
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)
A
QPolygonobject is aQVector<QPoint>. The easiest way to add points to aQPolygonis 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,QPolygonprovides some point-specific functions.Each point in a polygon can be retrieved by passing its index to the
point()function. To populate the polygon,QPolygonprovides 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).
QPolygonprovides theboundingRect()andtranslate()functions for geometry functions. Use themap()function for more general transformations of QPolygons.
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.
另请参阅
isEmpty()
Constructs a polygon of the given
size
. Creates an empty polygon if
size
== 0.
另请参阅
isEmpty()
PySide2.QtGui.QPolygon.
__reduce__
(
)
¶
PyObject
PySide2.QtGui.QPolygon.
append
(
t
)
¶
t
–
QPoint
PySide2.QtGui.QPolygon.
append
(
t
)
¶
t
–
QPoint
PySide2.QtGui.QPolygon.
append
(
l
)
¶
l –
PySide2.QtGui.QPolygon.
at
(
i
)
¶
i
–
int
QPoint
PySide2.QtGui.QPolygon.
back
(
)
¶
QPoint
PySide2.QtGui.QPolygon.
boundingRect
(
)
¶
QRect
Returns the bounding rectangle of the polygon, or
QRect
(0, 0, 0, 0) if the polygon is empty.
另请参阅
isEmpty()
PySide2.QtGui.QPolygon.
capacity
(
)
¶
int
PySide2.QtGui.QPolygon.
clear
(
)
¶
PySide2.QtGui.QPolygon.
constData
(
)
¶
QPoint
PySide2.QtGui.QPolygon.
constFirst
(
)
¶
QPoint
PySide2.QtGui.QPolygon.
constLast
(
)
¶
QPoint
PySide2.QtGui.QPolygon.
contains
(
t
)
¶
t
–
QPoint
bool
PySide2.QtGui.QPolygon.
containsPoint
(
pt
,
fillRule
)
¶
pt
–
QPoint
fillRule
–
FillRule
bool
返回
true
若给定
point
is inside the polygon according to the specified
fillRule
;否则返回
false
.
PySide2.QtGui.QPolygon.
count
(
)
¶
int
PySide2.QtGui.QPolygon.
count
(
t
)
¶
t
–
QPoint
int
PySide2.QtGui.QPolygon.
data
(
)
¶
QPoint
PySide2.QtGui.QPolygon.
empty
(
)
¶
bool
PySide2.QtGui.QPolygon.
endsWith
(
t
)
¶
t
–
QPoint
bool
PySide2.QtGui.QPolygon.
fill
(
t
[
,
size=-1
]
)
¶
t
–
QPoint
size
–
int
PySide2.QtGui.QPolygon.
first
(
)
¶
QPoint
PySide2.QtGui.QPolygon.
fromList
(
list
)
¶
list –
PySide2.QtGui.QPolygon.
front
(
)
¶
QPoint
PySide2.QtGui.QPolygon.
indexOf
(
t
[
,
from=0
]
)
¶
t
–
QPoint
from
–
int
int
PySide2.QtGui.QPolygon.
insert
(
i
,
t
)
¶
i
–
int
t
–
QPoint
PySide2.QtGui.QPolygon.
insert
(
i
,
t
)
¶
i
–
int
t
–
QPoint
PySide2.QtGui.QPolygon.
insert
(
i
,
n
,
t
)
¶
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.
另请参阅
PySide2.QtGui.QPolygon.
intersects
(
r
)
¶
r
–
QPolygon
bool
返回
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.
另请参阅
PySide2.QtGui.QPolygon.
isEmpty
(
)
¶
bool
other –
bool
PySide2.QtGui.QPolygon.
last
(
)
¶
QPoint
PySide2.QtGui.QPolygon.
lastIndexOf
(
t
[
,
from=-1
]
)
¶
t
–
QPoint
from
–
int
int
PySide2.QtGui.QPolygon.
length
(
)
¶
int
PySide2.QtGui.QPolygon.
mid
(
pos
[
,
len=-1
]
)
¶
pos
–
int
len
–
int
PySide2.QtGui.QPolygon.
move
(
from
,
to
)
¶
from
–
int
to
–
int
PySide2.QtGui.QPolygon.
__ne__
(
v
)
¶
v –
bool
PySide2.QtGui.QPolygon.
__mul__
(
m
)
¶
m
–
QTransform
PySide2.QtGui.QPolygon.
__add__
(
l
)
¶
l –
PySide2.QtGui.QPolygon.
__iadd__
(
t
)
¶
t
–
QPoint
PySide2.QtGui.QPolygon.
__iadd__
(
t
)
¶
t
–
QPoint
PySide2.QtGui.QPolygon.
__lshift__
(
t
)
¶
t
–
QPoint
PySide2.QtGui.QPolygon.
__lshift__
(
t
)
¶
t
–
QPoint
PySide2.QtGui.QPolygon.
__lshift__
(
l
)
¶
l –
PySide2.QtGui.QPolygon.
__eq__
(
v
)
¶
v –
bool
PySide2.QtGui.QPolygon.operator[](i)
i
–
int
QPoint
PySide2.QtGui.QPolygon.
pop_back
(
)
¶
PySide2.QtGui.QPolygon.
pop_front
(
)
¶
PySide2.QtGui.QPolygon.
prepend
(
t
)
¶
t
–
QPoint
PySide2.QtGui.QPolygon.
prepend
(
t
)
¶
t
–
QPoint
PySide2.QtGui.QPolygon.
push_back
(
t
)
¶
t
–
QPoint
PySide2.QtGui.QPolygon.
push_back
(
t
)
¶
t
–
QPoint
PySide2.QtGui.QPolygon.
push_front
(
t
)
¶
t
–
QPoint
PySide2.QtGui.QPolygon.
push_front
(
t
)
¶
t
–
QPoint
PySide2.QtGui.QPolygon.
remove
(
i
)
¶
i
–
int
PySide2.QtGui.QPolygon.
remove
(
i
,
n
)
¶
i
–
int
n
–
int
PySide2.QtGui.QPolygon.
removeAll
(
t
)
¶
t
–
QPoint
int
PySide2.QtGui.QPolygon.
removeAt
(
i
)
¶
i
–
int
PySide2.QtGui.QPolygon.
removeFirst
(
)
¶
PySide2.QtGui.QPolygon.
removeLast
(
)
¶
PySide2.QtGui.QPolygon.
removeOne
(
t
)
¶
t
–
QPoint
bool
PySide2.QtGui.QPolygon.
replace
(
i
,
t
)
¶
i
–
int
t
–
QPoint
PySide2.QtGui.QPolygon.
reserve
(
size
)
¶
size
–
int
PySide2.QtGui.QPolygon.
resize
(
size
)
¶
size
–
int
PySide2.QtGui.QPolygon.
setSharable
(
sharable
)
¶
sharable
–
bool
PySide2.QtGui.QPolygon.
shrink_to_fit
(
)
¶
PySide2.QtGui.QPolygon.
size
(
)
¶
int
PySide2.QtGui.QPolygon.
squeeze
(
)
¶
PySide2.QtGui.QPolygon.
startsWith
(
t
)
¶
t
–
QPoint
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
)
¶
other
–
QPolygon
Swaps polygon
other
with this polygon. This operation is very fast and never fails.
PySide2.QtGui.QPolygon.
swapItemsAt
(
i
,
j
)
¶
i
–
int
j
–
int
PySide2.QtGui.QPolygon.
takeAt
(
i
)
¶
i
–
int
QPoint
PySide2.QtGui.QPolygon.
takeFirst
(
)
¶
QPoint
PySide2.QtGui.QPolygon.
takeLast
(
)
¶
QPoint
PySide2.QtGui.QPolygon.
toList
(
)
¶
PySide2.QtGui.QPolygon.
translate
(
offset
)
¶
offset
–
QPoint
这是重载函数。
Translates all points in the polygon by the given
offset
.
另请参阅
PySide2.QtGui.QPolygon.
translate
(
dx
,
dy
)
¶
dx
–
int
dy
–
int
Translates all points in the polygon by (
dx
,
dy
).
另请参阅
PySide2.QtGui.QPolygon.
translated
(
offset
)
¶
offset
–
QPoint
这是重载函数。
Returns a copy of the polygon that is translated by the given
offset
.
另请参阅
PySide2.QtGui.QPolygon.
translated
(
dx
,
dy
)
¶
dx
–
int
dy
–
int
Returns a copy of the polygon that is translated by (
dx
,
dy
).
另请参阅
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.
PySide2.QtGui.QPolygon.
value
(
i
)
¶
i
–
int
QPoint
PySide2.QtGui.QPolygon.
value
(
i
,
defaultValue
)
¶
i
–
int
defaultValue
–
QPoint
QPoint