- class 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
Added 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
Methods¶
def
__init__()
def
grabGesture()
def
ungrabGesture()
Signals¶
def
enabledChanged()
def
heightChanged()
def
opacityChanged()
def
parentChanged()
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 ofQGraphicsItem
‘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 andQGraphicsItem
, you should use the functions provided byQGraphicsItem
, not QObject, to manage the relationships between parent and child items.The relationships between items can be explored using the
parentItem()
andchildItems()
functions. In the hierarchy of items in a scene, theparentObject()
andparentWidget()
functions are the equivalent of the QWidget::parent() andparentWidget()
functions forQWidget
subclasses.See also
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.
See also
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
.See also
- Access functions:
Signal
enabledChanged()
- property opacityᅟ: float¶
This property holds the opacity of the item.
See also
- Access functions:
Signal
opacityChanged()
- 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().
See also
- Access functions:
Signal
parentChanged()
This property holds the position of the item.
Describes the items position.
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:
Signal
rotationChanged()
- 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:
Signal
scaleChanged()
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 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 xᅟ: float¶
This property holds the x position of the item.
Describes the items x position.
- Access functions:
Signal
xChanged()
- property yᅟ: float¶
This property holds the y position of the item.
Describes the items y position.
- Access functions:
Signal
yChanged()
- property zᅟ: float¶
This property holds the z value of the item.
Describes the items z value.
See also
- Access functions:
Signal
zChanged()
- __init__([parent=None])¶
- Parameters:
parent –
QGraphicsItem
Constructs a
QGraphicsObject
withparent
.- childrenChanged()¶
- enabledChanged()¶
This signal gets emitted whenever the item gets enabled or disabled.
See also
Notification signal of property
enabledᅟ
.- grabGesture(type[, flags=Qt.GestureFlags()])¶
- Parameters:
type –
GestureType
flags – Combination of
GestureFlag
Subscribes the graphics object to the given
gesture
with specificflags
.See also
- heightChanged()¶
- opacityChanged()¶
This signal gets emitted whenever the opacity of the item changes
See also
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:
type –
GestureType
Unsubscribes the graphics object from the given
gesture
.See also
- 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
Notification signal of property
xᅟ
.- yChanged()¶
This signal gets emitted whenever the y position of the item changes.
See also
Notification signal of property
yᅟ
.- zChanged()¶
This signal gets emitted whenever the z value of the item changes.
See also
Notification signal of property
zᅟ
.