Obsolete Members for QGraphicsItem

以下成员源于类 QGraphicsItem 已过时。 提供它们是为使旧源代码能继续工作。强烈建议不要在新代码中使用它们。

公共函数

(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 )

成员函数文档编制

bool QGraphicsItem:: acceptsHoverEvents () const

调用 acceptHoverEvents () 代替。

另请参阅 setAcceptsHoverEvents ().

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

使用 childItems () 代替。

另请参阅 setParentItem ().

bool QGraphicsItem:: handlesChildEvents () const

返回 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.

另请参阅 setHandlesChildEvents ().

QMatrix QGraphicsItem:: matrix () const

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.

使用 transform () 代替。

另请参阅 setMatrix (), setTransform (),和 sceneTransform ().

void QGraphicsItem:: resetMatrix ()

使用 resetTransform () 代替。

void QGraphicsItem:: rotate ( qreal angle )

使用

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

代替。

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 ().

范例:

// 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));
					

另请参阅 setTransform (), transform (), scale (), shear (),和 translate ().

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

使用

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

代替。

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 ().

范例:

// 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));
					

另请参阅 setTransform () 和 transform ().

QMatrix QGraphicsItem:: sceneMatrix () const

使用 sceneTransform () 代替。

另请参阅 transform (), setTransform (), scenePos (),和 图形视图坐标系 .

void QGraphicsItem:: setAcceptsHoverEvents ( bool enabled )

使用 setAcceptHoverEvents ( enabled ) 代替。

另请参阅 acceptsHoverEvents ().

void QGraphicsItem:: setHandlesChildEvents ( bool enabled )

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 为 false,此项仅处理它自己的事件。默认值为 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.

另请参阅 handlesChildEvents ().

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

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.

使用 setTransform () 代替。

另请参阅 matrix (), transform (),和 图形视图坐标系 .

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

使用

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

代替。

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

另请参阅 setTransform () 和 transform ().

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

使用 setPos () 或 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 () 或 setPos () instead; this function changes the item's translation, which is conceptually separate from its position.

另请参阅 setTransform () 和 transform ().