|  | Home · All Classes · Modules

# QGraphicsObject Class Reference
[QtGui module]

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

Inherits QObject and QGraphicsItem.

Inherited by QGraphicsSvgItem, QGraphicsTextItem and QGraphicsWidget.

### Methods

- __init__ (self, QGraphicsItem parent = None)
- grabGesture (self, Qt.GestureType, Qt.GestureFlags flags = Qt.GestureFlags(0))
- ungrabGesture (self, Qt.GestureType)

### Qt Signals

- void enabledChanged ()
- void opacityChanged ()
- void parentChanged ()
- void rotationChanged ()
- void scaleChanged ()
- void visibleChanged ()
- void xChanged ()
- void yChanged ()
- void zChanged ()

## Detailed Description

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

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 QWidget.parentWidget() functions for QWidget subclasses.

See also QGraphicsWidget.

## Method Documentation

### QGraphicsObject.__init__ (self, QGraphicsItem parent = None)

The parent argument, if not None, causes self to be owned by Qt instead of PyQt.

Constructs a QGraphicsObject with parent.

### QGraphicsObject.grabGesture (self, Qt.GestureType, Qt.GestureFlags flags = Qt.GestureFlags(0))

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

See also ungrabGesture() and QGestureEvent.

### QGraphicsObject.ungrabGesture (self, Qt.GestureType)

Unsubscribes the graphics object from the given gesture.

See also grabGesture() and QGestureEvent.

## Qt Signal Documentation

### void enabledChanged ()

This is the default overload of this signal.

This signal gets emitted whenever the item get's enabled or disabled.

See also isEnabled().

### void opacityChanged ()

This is the default overload of this signal.

This signal gets emitted whenever the opacity of the item changes

See also QGraphicsItem.opacity().

### void parentChanged ()

This is the default overload of this signal.

This signal gets emitted whenever the parent of the item changes

### void rotationChanged ()

This is the default overload of this signal.

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

### void scaleChanged ()

This is the default overload of this signal.

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

### void visibleChanged ()

This is the default overload of this signal.

This signal gets emitted whenever the visibility of the item changes

See also visible.

### void xChanged ()

This is the default overload of this signal.

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

See also pos().

### void yChanged ()

This is the default overload of this signal.

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

See also pos().

### void zChanged ()

This is the default overload of this signal.

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

See also pos().