Obsolete Members for QGraphicsItem

The following members of class QGraphicsItem are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.

Public Functions

(obsolete) bool acceptsHoverEvents() const
(obsolete) QList<QGraphicsItem *> children() const
(obsolete) bool handlesChildEvents() const
(obsolete) QMatrix matrix() const
(obsolete) void resetMatrix()
(obsolete) void rotate(qreal angle)
(obsolete) void scale(qreal sx, qreal sy)
(obsolete) QMatrix sceneMatrix() const
(obsolete) void setAcceptsHoverEvents(bool enabled)
(obsolete) void setHandlesChildEvents(bool enabled)
(obsolete) void setMatrix(const QMatrix &matrix, bool combine = false)
(obsolete) void shear(qreal sh, qreal sv)
(obsolete) void translate(qreal dx, qreal dy)

Member Function Documentation

bool QGraphicsItem::acceptsHoverEvents() const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Call acceptHoverEvents() instead.

See also setAcceptsHoverEvents().

QList<QGraphicsItem *> QGraphicsItem::children() const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use childItems() instead.

See also setParentItem().

bool QGraphicsItem::handlesChildEvents() const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Returns true if this item handles child events (i.e., all events intended for any of its children are instead sent to this item); otherwise, false is returned.

This property is useful for item groups; it allows one item to handle events on behalf of its children, as opposed to its children handling their events individually.

The default is to return false; children handle their own events. The exception for this is if the item is a QGraphicsItemGroup, then it defaults to return true.

See also setHandlesChildEvents().

QMatrix QGraphicsItem::matrix() const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Returns the item's affine transformation matrix. This is a subset or the item's full transformation matrix, and might not represent the item's full transformation.

Use transform() instead.

See also setMatrix(), setTransform(), and sceneTransform().

void QGraphicsItem::resetMatrix()

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use resetTransform() instead.

void QGraphicsItem::rotate(qreal angle)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use

item->setTransform(QTransform().rotate(angle), true);

instead.

Rotates the current item transformation angle degrees clockwise around its origin. To translate around an arbitrary point (x, y), you need to combine translation and rotation with setTransform().

Example:

// Rotate an item 45 degrees around (0, 0).
item->rotate(45);

// Rotate an item 45 degrees around (x, y).
item->setTransform(QTransform().translate(x, y).rotate(45).translate(-x, -y));

See also setTransform(), transform(), scale(), shear(), and translate().

void QGraphicsItem::scale(qreal sx, qreal sy)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use

setTransform(QTransform::fromScale(sx, sy), true);

instead.

Scales the current item transformation by (sx, sy) around its origin. To scale from an arbitrary point (x, y), you need to combine translation and scaling with setTransform().

Example:

// Scale an item by 3x2 from its origin
item->scale(3, 2);

// Scale an item by 3x2 from (x, y)
item->setTransform(QTransform().translate(x, y).scale(3, 2).translate(-x, -y));

See also setTransform() and transform().

QMatrix QGraphicsItem::sceneMatrix() const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use sceneTransform() instead.

See also transform(), setTransform(), scenePos(), and The Graphics View Coordinate System.

void QGraphicsItem::setAcceptsHoverEvents(bool enabled)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use setAcceptHoverEvents(enabled) instead.

See also acceptsHoverEvents().

void QGraphicsItem::setHandlesChildEvents(bool enabled)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

If enabled is true, this item is set to handle all events for all its children (i.e., all events intented for any of its children are instead sent to this item); otherwise, if enabled is false, this item will only handle its own events. The default value is false.

This property is useful for item groups; it allows one item to handle events on behalf of its children, as opposed to its children handling their events individually.

If a child item accepts hover events, its parent will receive hover move events as the cursor passes through the child, but it does not receive hover enter and hover leave events on behalf of its child.

See also handlesChildEvents().

void QGraphicsItem::setMatrix(const QMatrix &matrix, bool combine = false)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Sets the item's affine transformation matrix. This is a subset or the item's full transformation matrix, and might not represent the item's full transformation.

Use setTransform() instead.

See also matrix(), transform(), and The Graphics View Coordinate System.

void QGraphicsItem::shear(qreal sh, qreal sv)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use

setTransform(QTransform().shear(sh, sv), true);

instead.

Shears the current item transformation by (sh, sv).

See also setTransform() and transform().

void QGraphicsItem::translate(qreal dx, qreal dy)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use setPos() or setTransformOriginPoint() instead. For identical behavior, use

setTransform(QTransform::fromTranslate(dx, dy), true);

Translates the current item transformation by (dx, dy).

If all you want is to move an item, you should call moveBy() or setPos() instead; this function changes the item's translation, which is conceptually separate from its position.

See also setTransform() and transform().

© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.