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

New in version 4.6.

Synopsis#

Properties#

  • effect - The effect attached to this item

  • enabled - Whether the item is enabled or not

  • opacity - The opacity of the item

  • parent - The parent of the item

  • pos - The position of the item

  • rotation - The rotation of the item in degrees

  • scale - The scale of the item

  • transformOriginPoint - The transformation origin

  • visible - Whether the item is visible or not

  • x - The x position of the item

  • y - The y position of the item

  • z - The z value of the item

Functions#

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

class PySide6.QtWidgets.QGraphicsObject([parent=None])#
Parameters:

parentPySide6.QtWidgets.QGraphicsItem

Constructs a QGraphicsObject with parent.

Note

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

property PᅟySide6.QtWidgets.QGraphicsObject.effect: PySide6.QtWidgets.QGraphicsEffect#

This property holds the effect attached to this item.

Access functions:

property PᅟySide6.QtWidgets.QGraphicsObject.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 PᅟySide6.QtWidgets.QGraphicsObject.opacity: float#

This property holds the opacity of the item.

Access functions:
property PᅟySide6.QtWidgets.QGraphicsObject.parent: PySide6.QtWidgets.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 PᅟySide6.QtWidgets.QGraphicsObject.pos: PySide6.QtCore.QPointF#

This property holds the position of the item.

Describes the items position.

See also

setPos() pos()

Access functions:

property PᅟySide6.QtWidgets.QGraphicsObject.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 PᅟySide6.QtWidgets.QGraphicsObject.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 PᅟySide6.QtWidgets.QGraphicsObject.transformOriginPoint: PySide6.QtCore.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 PᅟySide6.QtWidgets.QGraphicsObject.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 PᅟySide6.QtWidgets.QGraphicsObject.x: float#

This property holds the x position of the item.

Describes the items x position.

See also

setX() setPos()

Access functions:
property PᅟySide6.QtWidgets.QGraphicsObject.y: float#

This property holds the y position of the item.

Describes the items y position.

See also

setY() setPos()

Access functions:
property PᅟySide6.QtWidgets.QGraphicsObject.z: float#

This property holds the z value of the item.

Describes the items z value.

Access functions:
PySide6.QtWidgets.QGraphicsObject.childrenChanged()#
PySide6.QtWidgets.QGraphicsObject.enabledChanged()#

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

See also

isEnabled()

Notification signal of property enabled .

PySide6.QtWidgets.QGraphicsObject.grabGesture(type[, flags=Qt.GestureFlags()])#
Parameters:

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

PySide6.QtWidgets.QGraphicsObject.heightChanged()#
PySide6.QtWidgets.QGraphicsObject.opacityChanged()#

This signal gets emitted whenever the opacity of the item changes

See also

opacity()

Notification signal of property opacity .

PySide6.QtWidgets.QGraphicsObject.parentChanged()#

This signal gets emitted whenever the parent of the item changes

Notification signal of property parent .

PySide6.QtWidgets.QGraphicsObject.rotationChanged()#

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

Notification signal of property rotation .

PySide6.QtWidgets.QGraphicsObject.scaleChanged()#

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

Notification signal of property scale .

PySide6.QtWidgets.QGraphicsObject.ungrabGesture(type)#
Parameters:

typeGestureType

Unsubscribes the graphics object from the given gesture.

PySide6.QtWidgets.QGraphicsObject.visibleChanged()#

This signal gets emitted whenever the visibility of the item changes

See also

visible

Notification signal of property visible .

PySide6.QtWidgets.QGraphicsObject.widthChanged()#
PySide6.QtWidgets.QGraphicsObject.xChanged()#

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

See also

pos()

Notification signal of property x .

PySide6.QtWidgets.QGraphicsObject.yChanged()#

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

See also

pos()

Notification signal of property y .

PySide6.QtWidgets.QGraphicsObject.zChanged()#

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

See also

pos()

Notification signal of property z .