The PySide.QtGui.QPolygon class provides a vector of points using integer precision.
A PySide.QtGui.QPolygon object is a QVector < PySide.QtCore.QPoint >. The easiest way to add points to a PySide.QtGui.QPolygon is to use QVector ‘s streaming operator, as illustrated below:
polygon = QPolygon() polygon << QPoint(10, 20) << QPoint(20, 30)In addition to the functions provided by QVector , PySide.QtGui.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, PySide.QtGui.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).
PySide.QtGui.QPolygon provides the PySide.QtGui.QPolygon.boundingRect() and PySide.QtGui.QPolygon.translate() functions for geometry functions. Use the QMatrix.map() function for more general transformations of QPolygons.
The PySide.QtGui.QPolygon class is implicitly shared .
See also
Parameters: |
|
---|
Constructs a polygon with no points.
See also
QVector.isEmpty()
Constructs a copy of the given polygon .
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()
Constructs a polygon of the given size . Creates an empty polygon if size == 0.
See also
QVector.isEmpty()
Return type: | PyObject |
---|
Return type: | PySide.QtCore.int |
---|
Parameters: | t – PySide.QtCore.QPoint |
---|
Parameters: | i – PySide.QtCore.int |
---|---|
Return type: | PySide.QtCore.QPoint |
Return type: | PySide.QtCore.QRect |
---|
Returns the bounding rectangle of the polygon, or PySide.QtCore.QRect (0, 0, 0, 0) if the polygon is empty.
See also
QVector.isEmpty()
Return type: | PySide.QtCore.int |
---|
Return type: | PySide.QtCore.QPoint |
---|
Parameters: | t – PySide.QtCore.QPoint |
---|---|
Return type: | PySide.QtCore.bool |
Parameters: |
|
---|---|
Return type: | PySide.QtCore.bool |
Return type: | PySide.QtCore.int |
---|
Parameters: | t – PySide.QtCore.QPoint |
---|---|
Return type: | PySide.QtCore.int |
Return type: | PySide.QtCore.QPoint |
---|
Return type: | PySide.QtCore.bool |
---|
Parameters: | t – PySide.QtCore.QPoint |
---|---|
Return type: | PySide.QtCore.bool |
Parameters: |
|
---|---|
Return type: |
Parameters: |
|
---|---|
Return type: |
Return type: | PySide.QtCore.QPoint |
---|
Parameters: | list – |
---|---|
Return type: |
Return type: | PySide.QtCore.QPoint |
---|
Parameters: |
|
---|---|
Return type: | PySide.QtCore.int |
Parameters: |
|
---|
Parameters: |
|
---|---|
Return type: |
Parameters: |
|
---|
Parameters: | r – PySide.QtGui.QPolygon |
---|---|
Return type: | PySide.QtGui.QPolygon |
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.
Return type: | PySide.QtCore.bool |
---|
Parameters: | other – |
---|---|
Return type: | PySide.QtCore.bool |
Return type: | PySide.QtCore.QPoint |
---|
Parameters: |
|
---|---|
Return type: | PySide.QtCore.int |
Parameters: |
|
---|---|
Return type: |
Parameters: | v – |
---|---|
Return type: | PySide.QtCore.bool |
Parameters: | m – PySide.QtGui.QTransform |
---|---|
Return type: | PySide.QtGui.QPolygon |
Parameters: | m – PySide.QtGui.QMatrix |
---|---|
Return type: | PySide.QtGui.QPolygon |
Parameters: | l – |
---|---|
Return type: |
Parameters: | t – PySide.QtCore.QPoint |
---|---|
Return type: |
Parameters: | l – |
---|---|
Return type: |
Parameters: | t – PySide.QtCore.QPoint |
---|---|
Return type: |
Parameters: | v – |
---|---|
Return type: | PySide.QtCore.bool |
Parameters: | i – PySide.QtCore.int |
---|---|
Return type: | PySide.QtCore.QPoint |
Parameters: | t – PySide.QtCore.QPoint |
---|
Parameters: | t – PySide.QtCore.QPoint |
---|
Parameters: | t – PySide.QtCore.QPoint |
---|
Parameters: |
|
---|
Parameters: |
|
---|
Parameters: | i – PySide.QtCore.int |
---|
Parameters: |
|
---|
Parameters: | size – PySide.QtCore.int |
---|
Parameters: | size – PySide.QtCore.int |
---|
Parameters: | sharable – PySide.QtCore.bool |
---|
Return type: | PySide.QtCore.int |
---|
Return type: | PySide.QtCore.int |
---|
Parameters: | t – PySide.QtCore.QPoint |
---|---|
Return type: | PySide.QtCore.bool |
Parameters: | r – PySide.QtGui.QPolygon |
---|---|
Return type: | PySide.QtGui.QPolygon |
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.
Parameters: | other – PySide.QtGui.QPolygon |
---|
Swaps polygon other with this polygon. This operation is very fast and never fails.
Return type: |
---|
Parameters: | offset – PySide.QtCore.QPoint |
---|
This is an overloaded function.
Translates all points in the polygon by the given offset .
See also
Parameters: |
|
---|
Translates all points in the polygon by (dx , dy ).
See also
Parameters: |
|
---|---|
Return type: |
Returns a copy of the polygon that is translated by (dx , dy ).
See also
Parameters: | offset – PySide.QtCore.QPoint |
---|---|
Return type: | PySide.QtGui.QPolygon |
This is an overloaded function.
Returns a copy of the polygon that is translated by the given offset .
See also
Parameters: | r – PySide.QtGui.QPolygon |
---|---|
Return type: | PySide.QtGui.QPolygon |
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.
Parameters: | i – PySide.QtCore.int |
---|---|
Return type: | PySide.QtCore.QPoint |
Parameters: |
|
---|---|
Return type: |