QGraphicsEllipseItem#

The QGraphicsEllipseItem class provides an ellipse item that you can add to a QGraphicsScene . More

Inheritance diagram of PySide6.QtWidgets.QGraphicsEllipseItem

Synopsis#

Functions#

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description#

QGraphicsEllipseItem respresents an ellipse with a fill and an outline, and you can also use it for ellipse segments (see startAngle() , spanAngle() ).

graphicsview-ellipseitem1

graphicsview-ellipseitem-pie2

To set the item’s ellipse, pass a QRectF to QGraphicsEllipseItem ‘s constructor, or call setRect() . The rect() function returns the current ellipse geometry.

QGraphicsEllipseItem uses the rect and the pen width to provide a reasonable implementation of boundingRect() , shape() , and contains() . The paint() function draws the ellipse using the item’s associated pen and brush, which you can set by calling setPen() and setBrush() .

class PySide6.QtWidgets.QGraphicsEllipseItem([parent=None])#

PySide6.QtWidgets.QGraphicsEllipseItem(rect[, parent=None])

PySide6.QtWidgets.QGraphicsEllipseItem(x, y, w, h[, parent=None])

Parameters:

Constructs a QGraphicsEllipseItem . parent is passed to QAbstractGraphicsShapeItem ‘s constructor.

See also

addItem()

Constructs a QGraphicsEllipseItem using rect as the default rectangle. parent is passed to QAbstractGraphicsShapeItem ‘s constructor.

See also

addItem()

Constructs a QGraphicsEllipseItem using the rectangle defined by (x, y) and the given width and height, as the default rectangle. parent is passed to QAbstractGraphicsShapeItem ‘s constructor.

See also

addItem()

PySide6.QtWidgets.QGraphicsEllipseItem.rect()#
Return type:

PySide6.QtCore.QRectF

Returns the item’s ellipse geometry as a QRectF.

See also

setRect() drawEllipse()

PySide6.QtWidgets.QGraphicsEllipseItem.setRect(rect)#
Parameters:

rectPySide6.QtCore.QRectF

Sets the item’s ellipse geometry to rect. The rectangle’s left edge defines the left edge of the ellipse, and the rectangle’s top edge describes the top of the ellipse. The height and width of the rectangle describe the height and width of the ellipse.

See also

rect() drawEllipse()

PySide6.QtWidgets.QGraphicsEllipseItem.setRect(x, y, w, h)
Parameters:
  • x – float

  • y – float

  • w – float

  • h – float

PySide6.QtWidgets.QGraphicsEllipseItem.setSpanAngle(angle)#
Parameters:

angle – int

Sets the span angle for an ellipse segment to angle, which is in 16ths of a degree. This angle is used together with startAngle() to represent an ellipse segment (a pie). By default, the span angle is 5760 (360 * 16, a full ellipse).

See also

spanAngle() setStartAngle() drawPie()

PySide6.QtWidgets.QGraphicsEllipseItem.setStartAngle(angle)#
Parameters:

angle – int

Sets the start angle for an ellipse segment to angle, which is in 16ths of a degree. This angle is used together with spanAngle() for representing an ellipse segment (a pie). By default, the start angle is 0.

See also

startAngle() setSpanAngle() drawPie()

PySide6.QtWidgets.QGraphicsEllipseItem.spanAngle()#
Return type:

int

Returns the span angle of an ellipse segment in 16ths of a degree. This angle is used together with startAngle() for representing an ellipse segment (a pie). By default, this function returns 5760 (360 * 16, a full ellipse).

PySide6.QtWidgets.QGraphicsEllipseItem.startAngle()#
Return type:

int

Returns the start angle for an ellipse segment in 16ths of a degree. This angle is used together with spanAngle() for representing an ellipse segment (a pie). By default, the start angle is 0.