Obsolete Members for QGraphicsItem

QGraphicsItem 类的以下成员已被废弃。提供这些成员是为了确保旧源代码能够继续运行。我们强烈建议不要在新代码中使用它们。

公共函数

(deprecated) bool handlesChildEvents() const
(deprecated) void setHandlesChildEvents(bool enabled)

成员函数文档

[deprecated] bool QGraphicsItem::handlesChildEvents() const

此函数已弃用。我们强烈建议不要在新代码中使用它。

如果该项处理子项事件(即所有本应发送给其任何子项的事件都会转而发送给该项),则返回true ;否则返回false。

此属性对项目组非常有用;它允许一个项目代表其子项目处理事件,而不是让子项目各自处理自己的事件。

默认情况下返回 false;子项自行处理各自的事件。唯一例外是,如果该项为QGraphicsItemGroup ,则默认返回 true。

另请参阅 setHandlesChildEvents()。

[deprecated] void QGraphicsItem::setHandlesChildEvents(bool enabled)

此函数已弃用。我们强烈建议不要在新代码中使用它。

如果 `enabled ` 为 `true`,则该项将处理其所有子项的事件(即,原本 intended for 任何子项的事件都会被转发至该项);否则,如果 `enabled ` 为 `false`,该项仅处理自身的事件。默认值为 `false`。

此属性对于项目组非常有用;它允许一个项目代表其子项目处理事件,而不是让子项目各自处理自己的事件。

如果子项接受悬停事件,当光标经过该子项时,其父项将接收悬停移动事件,但不会代表该子项接收悬停进入和悬停离开事件。

另请参阅 ` handlesChildEvents()`。

© 2026 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.