class QGraphicsObject

The QGraphicsObject class provides a base class for all graphics items that require signals, slots and properties. More

Inheritance diagram of PySide6.QtWidgets.QGraphicsObject

Inherited by: QGraphicsWidget, QGraphicsProxyWidget, QGraphicsTextItem, QGraphicsSvgItem, QGraphicsVideoItem, QLegend, QChart, QPolarChart

Added in version 4.6.

Synopsis

Properties

Methods

Signals

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

The class extends a QGraphicsItem with QObject’s signal/slot and property mechanisms. It maps many of QGraphicsItem ‘s basic setters and getters to properties and adds notification signals for many of them.

Parents and Children

Each graphics object can be constructed with a parent item. This ensures that the item will be destroyed when its parent item is destroyed. Although QGraphicsObject inherits from both QObject and QGraphicsItem , you should use the functions provided by QGraphicsItem , not QObject, to manage the relationships between parent and child items.

The relationships between items can be explored using the parentItem() and childItems() functions. In the hierarchy of items in a scene, the parentObject() and parentWidget() functions are the equivalent of the QWidget::parent() and parentWidget() functions for QWidget subclasses.

See also

QGraphicsWidget

Note

Properties can be used directly when from __feature__ import true_property is used or via accessor functions otherwise.

property effectᅟ: QGraphicsEffect

This property holds the effect attached to this item.

Access functions:

property enabledᅟ: bool

This property holds whether the item is enabled or not.

This property is declared in QGraphicsItem .

By default, this property is true.

Access functions:
property opacityᅟ: float

This property holds the opacity of the item.

Access functions:
property parentᅟ: QGraphicsObject

This property holds the parent of the item.

Note

The item’s parent is set independently of the parent object returned by QObject::parent().

Access functions:
property posᅟ: QPointF

This property holds the position of the item.

Describes the items position.

See also

setPos() pos()

Access functions:

property rotationᅟ: float

This property holds the rotation of the item in degrees..

This specifies how many degrees to rotate the item around its transformOrigin. The default rotation is 0 degrees (i.e. not rotated at all).

Access functions:
property scaleᅟ: float

This property holds the scale of the item..

A scale of less than 1 means the item will be displayed smaller than normal, and a scale of greater than 1 means the item will be displayed larger than normal. A negative scale means the item will be mirrored.

By default, items are displayed at a scale of 1 (i.e. at their normal size).

Scaling is from the item’s transformOrigin.

Access functions:
property transformOriginPointᅟ: QPointF

This property holds the transformation origin.

This property sets a specific point in the item’s coordinate system as the origin for scale and rotation.

Access functions:

property visibleᅟ: bool

This property holds whether the item is visible or not.

This property is declared in QGraphicsItem .

By default, this property is true.

Access functions:
property xᅟ: float

This property holds the x position of the item.

Describes the items x position.

See also

setX() setPos()

Access functions:
property yᅟ: float

This property holds the y position of the item.

Describes the items y position.

See also

setY() setPos()

Access functions:
property zᅟ: float

This property holds the z value of the item.

Describes the items z value.

Access functions:
__init__([parent=None])
Parameters:

parentQGraphicsItem

Constructs a QGraphicsObject with parent.

childrenChanged()
enabledChanged()

This signal gets emitted whenever the item gets enabled or disabled.

See also

isEnabled()

Notification signal of property enabledᅟ .

grabGesture(type[, flags=Qt.GestureFlags()])
Parameters:

Subscribes the graphics object to the given gesture with specific flags.

heightChanged()
opacityChanged()

This signal gets emitted whenever the opacity of the item changes

See also

opacity()

Notification signal of property opacityᅟ .

parentChanged()

This signal gets emitted whenever the parent of the item changes

Notification signal of property parentᅟ .

rotationChanged()

This signal gets emitted whenever the rotation of the item changes.

Notification signal of property rotationᅟ .

scaleChanged()

This signal is emitted when the scale of the item changes.

Notification signal of property scaleᅟ .

ungrabGesture(type)
Parameters:

typeGestureType

Unsubscribes the graphics object from the given gesture.

visibleChanged()

This signal gets emitted whenever the visibility of the item changes

See also

visible

Notification signal of property visibleᅟ .

widthChanged()
xChanged()

This signal gets emitted whenever the x position of the item changes

See also

pos()

Notification signal of property xᅟ .

yChanged()

This signal gets emitted whenever the y position of the item changes.

See also

pos()

Notification signal of property yᅟ .

zChanged()

This signal gets emitted whenever the z value of the item changes.

See also

pos()

Notification signal of property zᅟ .