-
首页
-
PyQt 4.11.4
-
所有类
-
模块
QPolygon Class Reference
[
QtGui
module]
The QPolygon class provides a vector of points using integer
precision.
更多...
方法
-
__init__
(
self
)
-
__init__
(
self
, QPolygon
a
)
-
__init__
(
self
, list-of-QPoint
v
)
-
__init__
(
self
, QRect
rectangle
, bool
closed
= False)
-
__init__
(
self
, int
asize
)
-
__init__
(
self
, list-of-int
points
)
-
__init__
(
self
, QVariant
variant
)
-
append
(
self
, QPoint
value
)
-
QPoint
at
(
self
, int
i
)
-
QRect
boundingRect
(
self
)
-
clear
(
self
)
-
bool
contains
(
self
, QPoint
value
)
-
bool
containsPoint
(
self
, QPoint
pt
, Qt.FillRule
fillRule
)
-
int
count
(
self
, QPoint
value
)
-
int
count
(
self
)
-
sip.voidptr
data
(
self
)
-
fill
(
self
, QPoint
value
, int
size
= -1)
-
QPoint
first
(
self
)
-
int
indexOf
(
self
, QPoint
value
, int
from
= 0)
-
insert
(
self
, int
i
, QPoint
value
)
-
QPolygon
intersected
(
self
, QPolygon
r
)
-
bool
isEmpty
(
self
)
-
QPoint
last
(
self
)
-
int
lastIndexOf
(
self
, QPoint
value
, int
from
= -1)
-
QPolygon
mid
(
self
, int
pos
, int
length
= -1)
-
QPoint
point
(
self
, int
index
)
-
prepend
(
self
, QPoint
value
)
-
putPoints
(
self
, int
index
, int
firstx
, int
firsty
, ...)
-
putPoints
(
self
, int
index
, int
nPoints
, QPolygon
fromPolygon
, int
from
= 0)
-
remove
(
self
, int
i
)
-
remove
(
self
, int
i
, int
count
)
-
replace
(
self
, int
i
, QPoint
value
)
-
setPoint
(
self
, int
index
, QPoint
pt
)
-
setPoint
(
self
, int
index
, int
x
, int
y
)
-
setPoints
(
self
, list-of-int
points
)
-
setPoints
(
self
, int
firstx
, int
firsty
, ...)
-
int
size
(
self
)
-
QPolygon
subtracted
(
self
, QPolygon
r
)
-
swap
(
self
, QPolygon
other
)
-
translate
(
self
, int
dx
, int
dy
)
-
translate
(
self
, QPoint
offset
)
-
QPolygon
translated
(
self
, int
dx
, int
dy
)
-
QPolygon
translated
(
self
, QPoint
offset
)
-
QPolygon
united
(
self
, QPolygon
r
)
-
QPoint
value
(
self
, int
i
)
-
QPoint
value
(
self
, int
i
, QPoint
defaultValue
)
Special Methods
-
QPolygon
__add__
(
self
, QPolygon
other
)
-
int
__contains__
(
self
, QPoint
value
)
-
__delitem__
(
self
, int
i
)
-
__delitem__
(
self
, slice
slice
)
-
bool
__eq__
(
self
, QPolygon
other
)
-
QPoint
__getitem__
(
self
, int
i
)
-
QPolygon
__getitem__
(
self
, slice
slice
)
-
QPolygon
__iadd__
(
self
, QPolygon
other
)
-
QPolygon
__iadd__
(
self
, QPoint
value
)
-
__len__
(
self
)
-
object
__lshift__
(
self
, QPoint
value
)
-
QPolygon
__mul__
(
self
, QMatrix
m
)
-
QPolygon
__mul__
(
self
, QTransform
m
)
-
bool
__ne__
(
self
, QPolygon
other
)
-
__setitem__
(
self
, int
i
, QPoint
value
)
-
__setitem__
(
self
, slice
slice
, QPolygon
list
)
详细描述
This class can be pickled.
The QPolygon class provides a vector of points using integer
precision.
A QPolygon object is a
QVector
<
QPoint
>.
The easiest way to add points to a QPolygon is to use
QVector
's streaming operator, as illustrated
below:
QPolygon polygon;
polygon << QPoint(10, 20) << QPoint(20, 30);
In addition to the functions provided by
QVector
, QPolygon provides some point-specific
函数。
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),
和
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
() 和
translate
() functions for geometry
functions. Use the
QMatrix.map
()
function for more general transformations of QPolygons.
The QPolygon class is
implicitly
shared
.
方法文档编制
QPolygon.__init__ (
self
)
Constructs a polygon with no points.
另请参阅
QVector.isEmpty
().
QPolygon.__init__ (
self
,
QPolygon
a
)
Constructs a polygon of the given
size
. Creates an empty
polygon if
size
== 0.
另请参阅
QVector.isEmpty
().
QPolygon.__init__ (
self
, list-of-QPoint
v
)
构造副本为给定
polygon
.
另请参阅
setPoints
().
QPolygon.__init__ (
self
,
QRect
rectangle
, bool
closed
= False)
Constructs a polygon containing the specified
points
.
另请参阅
setPoints
().
QPolygon.__init__ (
self
, int
asize
)
Constructs a polygon from the given
rectangle
。若
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()).
另请参阅
setPoints
().
QPolygon.__init__ (
self
, list-of-int
points
)
QPolygon.__init__ (
self
, QVariant
variant
)
QPolygon.append (
self
,
QPoint
value
)
QPoint
QPolygon.at (
self
, int
i
)
QRect
QPolygon.boundingRect (
self
)
Returns the bounding rectangle of the polygon, or
QRect
(0, 0, 0, 0) if the polygon is empty.
另请参阅
QVector.isEmpty
().
QPolygon.clear (
self
)
bool QPolygon.contains (
self
,
QPoint
value
)
bool QPolygon.containsPoint (
self
,
QPoint
pt
,
Qt.FillRule
fillRule
)
Returns true if the given
point
is inside the polygon
according to the specified
fillRule
;否则返回
false.
该函数在 Qt 4.3 引入。
int QPolygon.count (
self
,
QPoint
value
)
int QPolygon.count (
self
)
sip.voidptr QPolygon.data (
self
)
QPolygon.fill (
self
,
QPoint
value
, int
size
= -1)
QPoint
QPolygon.first (
self
)
int QPolygon.indexOf (
self
,
QPoint
value
, int
from
= 0)
QPolygon.insert (
self
, int
i
,
QPoint
value
)
QPolygon
QPolygon.intersected (
self
,
QPolygon
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.
该函数在 Qt 4.3 引入。
bool QPolygon.isEmpty (
self
)
QPoint
QPolygon.last (
self
)
int QPolygon.lastIndexOf (
self
,
QPoint
value
, int
from
= -1)
QPolygon
QPolygon.mid (
self
, int
pos
, int
length
= -1)
QPoint
QPolygon.point (
self
, int
index
)
Extracts the coordinates of the point at the given
index
to *
x
and *
y
(if they are valid pointers).
另请参阅
setPoint
().
QPolygon.prepend (
self
,
QPoint
value
)
QPolygon.putPoints (
self
, int
index
, int
firstx
, int
firsty
, ...)
拷贝
nPoints
points from the variable argument list
into this polygon from the given
index
.
The points are given as a sequence of integers, starting with
firstx
then
firsty
, and so on. The polygon is resized
if
index+nPoints
exceeds its current size.
The example code creates a polygon with three points (4,5),
(6,7) and (8,9), by expanding the polygon from 1 to 3 points:
QPolygon polygon(1);
polygon[0] = QPoint(4, 5);
polygon.putPoints(1, 2, 6,7, 8,9);
The following code has the same result, but here the putPoints()
function overwrites rather than extends:
QPolygon polygon(3);
polygon.putPoints(0, 3, 4,5, 0,0, 8,9);
polygon.putPoints(1, 1, 6,7);
另请参阅
setPoints
().
QPolygon.putPoints (
self
, int
index
, int
nPoints
,
QPolygon
fromPolygon
, int
from
= 0)
QPolygon.remove (
self
, int
i
)
QPolygon.remove (
self
, int
i
, int
count
)
QPolygon.replace (
self
, int
i
,
QPoint
value
)
QPolygon.setPoint (
self
, int
index
,
QPoint
pt
)
Sets the point at the given
index
to the point specified
by (
x
,
y
).
另请参阅
point
(),
putPoints
(),和
setPoints
().
QPolygon.setPoint (
self
, int
index
, int
x
, int
y
)
这是重载函数。
Sets the point at the given
index
到给定
point
.
QPolygon.setPoints (
self
, list-of-int
points
)
Resizes the polygon to
nPoints
and populates it with the
given
points
.
The example code creates a polygon with two points (10, 20) and
(30, 40):
static const int points[] = { 10, 20, 30, 40 };
QPolygon polygon;
polygon.setPoints(2, points);
另请参阅
setPoint
()
and
putPoints
().
QPolygon.setPoints (
self
, int
firstx
, int
firsty
, ...)
这是重载函数。
Resizes the polygon to
nPoints
and populates it with the
points specified by the variable argument list. The points are
given as a sequence of integers, starting with
firstx
then
firsty
, and so on.
The example code creates a polygon with two points (10, 20) and
(30, 40):
QPolygon polygon;
polygon.setPoints(2, 10, 20, 30, 40);
int QPolygon.size (
self
)
QPolygon
QPolygon.subtracted (
self
,
QPolygon
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.
该函数在 Qt 4.3 引入。
QPolygon.swap (
self
,
QPolygon
other
)
Swaps polygon
other
with this polygon. This operation is
very fast and never fails.
该函数在 Qt 4.8 引入。
QPolygon.translate (
self
, int
dx
, int
dy
)
Translates all points in the polygon by (
dx
,
dy
).
另请参阅
translated
().
QPolygon.translate (
self
,
QPoint
offset
)
这是重载函数。
Translates all points in the polygon by the given
offset
.
另请参阅
translated
().
QPolygon
QPolygon.translated (
self
, int
dx
, int
dy
)
Returns a copy of the polygon that is translated by (
dx
,
dy
).
该函数在 Qt 4.6 引入。
另请参阅
translate
().
QPolygon
QPolygon.translated (
self
,
QPoint
offset
)
这是重载函数。
Returns a copy of the polygon that is translated by the given
offset
.
该函数在 Qt 4.6 引入。
另请参阅
translate
().
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.
该函数在 Qt 4.3 引入。
另请参阅
intersected
() 和
subtracted
().
QPoint
QPolygon.value (
self
, int
i
)
QPoint
QPolygon.value (
self
, int
i
,
QPoint
defaultValue
)
QPolygon
QPolygon.__add__ (
self
,
QPolygon
other
)
int QPolygon.__contains__ (
self
,
QPoint
value
)
QPolygon.__delitem__ (
self
, int
i
)
QPolygon.__delitem__ (
self
, slice
slice
)
bool QPolygon.__eq__ (
self
,
QPolygon
other
)
QPoint
QPolygon.__getitem__ (
self
, int
i
)
QPolygon
QPolygon.__getitem__ (
self
, slice
slice
)
QPolygon
QPolygon.__iadd__ (
self
,
QPolygon
other
)
QPolygon
QPolygon.__iadd__ (
self
,
QPoint
value
)
QPolygon.__len__ (
self
)
object QPolygon.__lshift__ (
self
,
QPoint
value
)
QPolygon
QPolygon.__mul__ (
self
,
QMatrix
m
)
bool QPolygon.__ne__ (
self
,
QPolygon
other
)
QPolygon.__setitem__ (
self
, int
i
,
QPoint
value
)
QPolygon.__setitem__ (
self
, slice
slice
,
QPolygon
list
)
-
首页
-
PyQt 4.11.4
-
文档编制