IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QGraphicsObject Class

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

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QGraphicsObject Class

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

See Also

See also QGraphicsWidget

Property Documentation

 

effect : QGraphicsEffect* const

This property holds the effect attached to this item

See Also

enabled : const bool

This property holds whether the item is enabled or not

This property is declared in QGraphicsItem.

By default, this property is true.

Notifier signal:

See Also

opacity : const qreal

This property holds the opacity of the item

Notifier signal:

See Also

parent : QGraphicsObject* const

This property holds the parent of the item

The item's parent is set independently of the parent object returned by QObject::parent().

Notifier signal:

See Also

pos : const QPointF

This property holds the position of the item

Describes the items position.

See Also

rotation : 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).

Notifier signal:

scale : 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.

Notifier signal:

transformOriginPoint : const 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

visible : const bool

This property holds whether the item is visible or not

This property is declared in QGraphicsItem.

By default, this property is true.

Notifier signal:

See Also

x : const qreal

This property holds the x position of the item

Describes the items x position.

Notifier signal:

See Also

See also QGraphicsItem::setX(), setPos()

y : const qreal

This property holds the y position of the item

Describes the items y position.

Notifier signal:

See Also

See also QGraphicsItem::setY(), setPos()

z : const qreal

This property holds the z value of the item

Describes the items z value.

Notifier signal:

See Also

Member Function Documentation

 

[explicit] QGraphicsObject::QGraphicsObject(QGraphicsItem *parent = nullptr)

Constructs a QGraphicsObject with parent.

[virtual] QGraphicsObject::~QGraphicsObject()

Destructor.

void QGraphicsObject::enabledChanged()

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

Notifier signal for property enabled.

See Also

See also isEnabled()

[override virtual protected] bool QGraphicsObject::event(QEvent *ev)

Reimplements: QObject::event(QEvent *e).

void QGraphicsObject::grabGesture(Qt::GestureType gesture, Qt::GestureFlags flags = Qt::GestureFlags())

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

See Also

void QGraphicsObject::opacityChanged()

This signal gets emitted whenever the opacity of the item changes

Notifier signal for property opacity.

See Also

void QGraphicsObject::parentChanged()

This signal gets emitted whenever the parent of the item changes

Notifier signal for property parent.

void QGraphicsObject::rotationChanged()

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

Notifier signal for property rotation.

void QGraphicsObject::scaleChanged()

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

Notifier signal for property scale.

void QGraphicsObject::ungrabGesture(Qt::GestureType gesture)

Unsubscribes the graphics object from the given gesture.

See Also

[protected] void QGraphicsObject::updateMicroFocus()

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

See Also

See also QInputMethod

void QGraphicsObject::visibleChanged()

This signal gets emitted whenever the visibility of the item changes

Notifier signal for property visible.

See Also

See also visible

void QGraphicsObject::xChanged()

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

Notifier signal for property x.

See Also

See also pos()

void QGraphicsObject::yChanged()

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

Notifier signal for property y.

See Also

See also pos()

void QGraphicsObject::zChanged()

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

Notifier signal for property z.

See Also

See also pos()

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+