Table Of Contents

Previous topic

QPolygonF

Next topic

QColor

QPolygon

Synopsis

Functions

Static functions

Detailed Description

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 .

class PySide.QtGui.QPolygon
class PySide.QtGui.QPolygon(a)
class PySide.QtGui.QPolygon(r[, closed=false])
class PySide.QtGui.QPolygon(v)
class PySide.QtGui.QPolygon(size)
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()

PySide.QtGui.QPolygon.__reduce__()
Return type:PyObject
PySide.QtGui.QPolygon.alignOfTypedData()
Return type:PySide.QtCore.int
PySide.QtGui.QPolygon.append(t)
Parameters:tPySide.QtCore.QPoint
PySide.QtGui.QPolygon.at(i)
Parameters:iPySide.QtCore.int
Return type:PySide.QtCore.QPoint
PySide.QtGui.QPolygon.boundingRect()
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()

PySide.QtGui.QPolygon.capacity()
Return type:PySide.QtCore.int
PySide.QtGui.QPolygon.clear()
PySide.QtGui.QPolygon.constData()
Return type:PySide.QtCore.QPoint
PySide.QtGui.QPolygon.contains(t)
Parameters:tPySide.QtCore.QPoint
Return type:PySide.QtCore.bool
PySide.QtGui.QPolygon.containsPoint(pt, fillRule)
Parameters:
Return type:

PySide.QtCore.bool

PySide.QtGui.QPolygon.count()
Return type:PySide.QtCore.int
PySide.QtGui.QPolygon.count(t)
Parameters:tPySide.QtCore.QPoint
Return type:PySide.QtCore.int
PySide.QtGui.QPolygon.data()
Return type:PySide.QtCore.QPoint
PySide.QtGui.QPolygon.detach_helper()
PySide.QtGui.QPolygon.empty()
Return type:PySide.QtCore.bool
PySide.QtGui.QPolygon.endsWith(t)
Parameters:tPySide.QtCore.QPoint
Return type:PySide.QtCore.bool
PySide.QtGui.QPolygon.erase(abegin, aend)
Parameters:
Return type:

PySide.QtCore.QPoint

PySide.QtGui.QPolygon.fill(t[, size=-1])
Parameters:
Return type:

PySide.QtGui.QPolygon.first()
Return type:PySide.QtCore.QPoint
static PySide.QtGui.QPolygon.fromList(list)
Parameters:list
Return type:
PySide.QtGui.QPolygon.front()
Return type:PySide.QtCore.QPoint
PySide.QtGui.QPolygon.indexOf(t[, from=0])
Parameters:
Return type:

PySide.QtCore.int

PySide.QtGui.QPolygon.insert(i, n, t)
Parameters:
PySide.QtGui.QPolygon.insert(before, n, t)
Parameters:
Return type:

PySide.QtCore.QPoint

PySide.QtGui.QPolygon.insert(i, t)
Parameters:
PySide.QtGui.QPolygon.intersected(r)
Parameters:rPySide.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.

PySide.QtGui.QPolygon.isEmpty()
Return type:PySide.QtCore.bool
PySide.QtGui.QPolygon.isSharedWith(other)
Parameters:other
Return type:PySide.QtCore.bool
PySide.QtGui.QPolygon.last()
Return type:PySide.QtCore.QPoint
PySide.QtGui.QPolygon.lastIndexOf(t[, from=-1])
Parameters:
Return type:

PySide.QtCore.int

PySide.QtGui.QPolygon.mid(pos[, length=-1])
Parameters:
  • posPySide.QtCore.int
  • lengthPySide.QtCore.int
Return type:

PySide.QtGui.QPolygon.__ne__(v)
Parameters:v
Return type:PySide.QtCore.bool
PySide.QtGui.QPolygon.__mul__(m)
Parameters:mPySide.QtGui.QTransform
Return type:PySide.QtGui.QPolygon
PySide.QtGui.QPolygon.__mul__(m)
Parameters:mPySide.QtGui.QMatrix
Return type:PySide.QtGui.QPolygon
PySide.QtGui.QPolygon.__add__(l)
Parameters:l
Return type:
PySide.QtGui.QPolygon.__iadd__(t)
Parameters:tPySide.QtCore.QPoint
Return type:
PySide.QtGui.QPolygon.__lshift__(l)
Parameters:l
Return type:
PySide.QtGui.QPolygon.__lshift__(t)
Parameters:tPySide.QtCore.QPoint
Return type:
PySide.QtGui.QPolygon.__eq__(v)
Parameters:v
Return type:PySide.QtCore.bool
PySide.QtGui.QPolygon.operator[](i)
Parameters:iPySide.QtCore.int
Return type:PySide.QtCore.QPoint
PySide.QtGui.QPolygon.pop_back()
PySide.QtGui.QPolygon.pop_front()
PySide.QtGui.QPolygon.prepend(t)
Parameters:tPySide.QtCore.QPoint
PySide.QtGui.QPolygon.push_back(t)
Parameters:tPySide.QtCore.QPoint
PySide.QtGui.QPolygon.push_front(t)
Parameters:tPySide.QtCore.QPoint
PySide.QtGui.QPolygon.realloc(size, alloc)
Parameters:
  • sizePySide.QtCore.int
  • allocPySide.QtCore.int
PySide.QtGui.QPolygon.remove(i, n)
Parameters:
  • iPySide.QtCore.int
  • nPySide.QtCore.int
PySide.QtGui.QPolygon.remove(i)
Parameters:iPySide.QtCore.int
PySide.QtGui.QPolygon.replace(i, t)
Parameters:
PySide.QtGui.QPolygon.reserve(size)
Parameters:sizePySide.QtCore.int
PySide.QtGui.QPolygon.resize(size)
Parameters:sizePySide.QtCore.int
PySide.QtGui.QPolygon.setSharable(sharable)
Parameters:sharablePySide.QtCore.bool
PySide.QtGui.QPolygon.size()
Return type:PySide.QtCore.int
PySide.QtGui.QPolygon.sizeOfTypedData()
Return type:PySide.QtCore.int
PySide.QtGui.QPolygon.squeeze()
PySide.QtGui.QPolygon.startsWith(t)
Parameters:tPySide.QtCore.QPoint
Return type:PySide.QtCore.bool
PySide.QtGui.QPolygon.subtracted(r)
Parameters:rPySide.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.

PySide.QtGui.QPolygon.swap(other)
Parameters:otherPySide.QtGui.QPolygon

Swaps polygon other with this polygon. This operation is very fast and never fails.

PySide.QtGui.QPolygon.toList()
Return type:
PySide.QtGui.QPolygon.translate(offset)
Parameters:offsetPySide.QtCore.QPoint

This is an overloaded function.

Translates all points in the polygon by the given offset .

PySide.QtGui.QPolygon.translate(dx, dy)
Parameters:
  • dxPySide.QtCore.int
  • dyPySide.QtCore.int

Translates all points in the polygon by (dx , dy ).

PySide.QtGui.QPolygon.translated(dx, dy)
Parameters:
  • dxPySide.QtCore.int
  • dyPySide.QtCore.int
Return type:

PySide.QtGui.QPolygon

Returns a copy of the polygon that is translated by (dx , dy ).

PySide.QtGui.QPolygon.translated(offset)
Parameters:offsetPySide.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 .

PySide.QtGui.QPolygon.united(r)
Parameters:rPySide.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.

PySide.QtGui.QPolygon.value(i)
Parameters:iPySide.QtCore.int
Return type:PySide.QtCore.QPoint
PySide.QtGui.QPolygon.value(i, defaultValue)
Parameters:
Return type:

PySide.QtCore.QPoint