QGraphicsObject Class Reference

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

  1. #include <QGraphicsObject>

Inherits: QObject and QGraphicsItem.

Inherited by: QDeclarativeItem, QGraphicsSvgItem, QGraphicsTextItem, and QGraphicsWidget.

This class was introduced in Qt 4.6.

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.

Properties

Toggle detailseffecteffect : QGraphicsEffect * const

This property holds the effect attached to this item

See also QGraphicsItem::setGraphicsEffect() and QGraphicsItem::graphicsEffect().

Access functions:

    Look up this member in the source code.

    Toggle detailsenabledenabled : const 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 QGraphicsItem::isEnabled(), QGraphicsItem::setEnabled(), and QGraphicsObject::enabledChanged().

    Access functions:

    Look up this member in the source code.

    Toggle detailsopacityopacity : const qreal

    This property holds the opacity of the item

    See also QGraphicsItem::setOpacity() and QGraphicsItem::opacity().

    Access functions:

    Look up this member in the source code.

    Toggle detailsparentparent : QGraphicsObject * const

    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 QGraphicsItem::setParentItem() and QGraphicsItem::parentObject().

    Access functions:

    Look up this member in the source code.

    Toggle detailspospos : const QPointF

    This property holds the position of the item

    Describes the items position.

    See also QGraphicsItem::setPos() and QGraphicsItem::pos().

    Access functions:

      Look up this member in the source code.

      Toggle detailsrotationrotation : const qreal

      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:

      Look up this member in the source code.

      Toggle detailsscalescale : const qreal

      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:

      Look up this member in the source code.

      Toggle detailstransformOriginPointtransformOriginPoint : const QPointF

      This property holds the transformation origin

      This property sets a specific point in the items coordiante system as the origin for scale and rotation.

      See also scale, rotation, and QGraphicsItem::transformOriginPoint().

      Access functions:

        Look up this member in the source code.

        Toggle detailsvisiblevisible : const 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 QGraphicsItem::isVisible(), QGraphicsItem::setVisible(), and visibleChanged().

        Access functions:

        Look up this member in the source code.

        Toggle detailsxx : const qreal

        This property holds the x position of the item

        Describes the items x position.

        See also QGraphicsItem::setX(), setPos(), and xChanged().

        Access functions:

        Look up this member in the source code.

        Toggle detailsyy : const qreal

        This property holds the y position of the item

        Describes the items y position.

        See also QGraphicsItem::setY(), setPos(), and yChanged().

        Access functions:

        Look up this member in the source code.

        Toggle detailszz : const qreal

        This property holds the z value of the item

        Describes the items z value.

        See also QGraphicsItem::setZValue(), zValue(), and zChanged().

        Access functions:

        Look up this member in the source code.

          Public Functions

          Toggle details QGraphicsObject

          QGraphicsObjectQGraphicsObject ( QGraphicsItem *parent=0 ) ( QGraphicsItem *parent=0 )

          Constructs a QGraphicsObject with parent.

          Look up this member in the source code.

          Toggle details void QGraphicsObject

          grabGesturegrabGesture ( Qt::GestureType gesture , Qt::GestureFlags flags=Qt::GestureFlags() ...) ( Qt::GestureType gesture , Qt::GestureFlags flags=Qt::GestureFlags() )

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

          See also ungrabGesture() and QGestureEvent.

          Look up this member in the source code.

          Toggle details void QGraphicsObject

          ungrabGestureungrabGesture ( Qt::GestureType gesture ) ( Qt::GestureType gesture )

          Unsubscribes the graphics object from the given gesture.

          See also grabGesture() and QGestureEvent.

          Look up this member in the source code.

            Signals

            Toggle details void QGraphicsObject

            enabledChangedenabledChanged () () [signal]

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

            See also isEnabled().

            Look up this member in the source code.

            Toggle details void QGraphicsObject

            opacityChangedopacityChanged () () [signal]

            This signal gets emitted whenever the opacity of the item changes

            See also QGraphicsItem::opacity().

            Look up this member in the source code.

            Toggle details void QGraphicsObject

            parentChangedparentChanged () () [signal]

            This signal gets emitted whenever the parent of the item changes

            Look up this member in the source code.

            Toggle details void QGraphicsObject

            rotationChangedrotationChanged () () [signal]

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

            Look up this member in the source code.

            Toggle details void QGraphicsObject

            scaleChangedscaleChanged () () [signal]

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

            Look up this member in the source code.

            Toggle details void QGraphicsObject

            visibleChangedvisibleChanged () () [signal]

            This signal gets emitted whenever the visibility of the item changes

            See also visible.

            Look up this member in the source code.

            Toggle details void QGraphicsObject

            xChangedxChanged () () [signal]

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

            See also pos().

            Look up this member in the source code.

            Toggle details void QGraphicsObject

            yChangedyChanged () () [signal]

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

            See also pos().

            Look up this member in the source code.

            Toggle details void QGraphicsObject

            zChangedzChanged () () [signal]

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

            See also pos().

            Look up this member in the source code.

              Public Slots

              Toggle details void QGraphicsObject

              updateMicroFocusupdateMicroFocus () ()[protected] [slot]

              Updates the item's micro focus. This is slot for convenience.

              See also QInputContext.

              Look up this member in the source code.

                Notes provided by the Qt Community

                No notes