QGraphicsObject#
The QGraphicsObject class provides a base class for all graphics items that require signals, slots and properties. More…
Inherited by: QGraphicsWidget, QGraphicsProxyWidget, QGraphicsTextItem, QGraphicsSvgItem, QGraphicsVideoItem, QLegend, QChart, QPolarChart
New in version 4.6.
Synopsis#
Properties#
effect- The effect attached to this itemenabled- Whether the item is enabled or notopacity- The opacity of the itemparent- The parent of the itempos- The position of the itemrotation- The rotation of the item in degreesscale- The scale of the itemtransformOriginPoint- The transformation originvisible- Whether the item is visible or notx- The x position of the itemy- The y position of the itemz- The z value of the item
Functions#
def
grabGesture(type[, flags=Qt.GestureFlags()])def
ungrabGesture(type)
Signals#
def
childrenChanged()def
enabledChanged()def
heightChanged()def
opacityChanged()def
parentChanged()def
rotationChanged()def
scaleChanged()def
visibleChanged()def
widthChanged()def
xChanged()def
yChanged()def
zChanged()
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 parent() and parentWidget() functions for QWidget subclasses.
See also
- class PySide6.QtWidgets.QGraphicsObject([parent=None])#
- Parameters:
parent –
PySide6.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.
See also
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.
See also
- Access functions:
Signal
enabledChanged()
- property PᅟySide6.QtWidgets.QGraphicsObject.opacity: float#
This property holds the opacity of the item.
See also
- Access functions:
Signal
opacityChanged()
- 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 parent() .
See also
- Access functions:
Signal
parentChanged()
- property PᅟySide6.QtWidgets.QGraphicsObject.pos: PySide6.QtCore.QPointF#
This property holds the position of the item.
Describes the items position.
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:
Signal
rotationChanged()
- 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:
Signal
scaleChanged()
- 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.
See also
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.
See also
- Access functions:
Signal
visibleChanged()
- property PᅟySide6.QtWidgets.QGraphicsObject.x: float#
This property holds the x position of the item.
Describes the items x position.
- Access functions:
Signal
xChanged()
- property PᅟySide6.QtWidgets.QGraphicsObject.y: float#
This property holds the y position of the item.
Describes the items y position.
- Access functions:
Signal
yChanged()
- property PᅟySide6.QtWidgets.QGraphicsObject.z: float#
This property holds the z value of the item.
Describes the items z value.
See also
- Access functions:
Signal
zChanged()
- PySide6.QtWidgets.QGraphicsObject.childrenChanged()#
- PySide6.QtWidgets.QGraphicsObject.enabledChanged()#
This signal gets emitted whenever the item gets enabled or disabled.
See also
Notification signal of property enabled .
- PySide6.QtWidgets.QGraphicsObject.grabGesture(type[, flags=Qt.GestureFlags()])#
- Parameters:
type –
GestureTypeflags –
GestureFlags
Subscribes the graphics object to the given gesture with specific flags.
See also
- PySide6.QtWidgets.QGraphicsObject.heightChanged()#
- PySide6.QtWidgets.QGraphicsObject.opacityChanged()#
This signal gets emitted whenever the opacity of the item changes
See also
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:
type –
GestureType
Unsubscribes the graphics object from the given gesture.
See also
- 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
Notification signal of property x .
- PySide6.QtWidgets.QGraphicsObject.yChanged()#
This signal gets emitted whenever the y position of the item changes.
See also
Notification signal of property y .
- PySide6.QtWidgets.QGraphicsObject.zChanged()#
This signal gets emitted whenever the z value of the item changes.
See also
Notification signal of property z .