Obsolete Members for QQuickItem

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

公共函数

(deprecated) void grabMouse()
(deprecated) void grabTouchPoints(const QList<int> &ids)
(deprecated) void ungrabMouse()
(deprecated) void ungrabTouchPoints()

成员函数文档

[deprecated] void QQuickItem::grabMouse()

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

请改用 `QPointerEvent::setExclusiveGrabber()`。

捕获鼠标输入。

该项将接收所有鼠标事件,直到调用ungrabMouse()为止。通常不应调用此函数,因为接收鼠标点击事件等操作可确保后续事件被传递给该项。如果某项希望从当前接收者处接管鼠标事件,则需要调用此函数。

警告: 使用此 函数时应谨慎。

[deprecated] void QQuickItem::grabTouchPoints(const QList<int> &ids)

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

请使用 `QPointerEvent::setExclusiveGrabber()`。该函数会获取由 `ids` 指定的触点。

这些触点将由该项目持有,直到被释放为止。此外,抓取操作可能会被 Flickable 等过滤项目“抢走”。请使用setKeepTouchGrab() 来防止抓取操作被“抢走”。

[deprecated] void QQuickItem::ungrabMouse()

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

请使用 `QPointerEvent::setExclusiveGrabber()`。

在调用grabMouse() 之后释放鼠标抓取状态。

请注意,仅当项目希望停止处理后续事件时,才应调用此函数。在发生释放或取消事件后,无需调用此函数,因为无论如何都不会再接收任何后续事件。调用此函数后,将不再传递任何移动或释放事件。

[deprecated] void QQuickItem::ungrabTouchPoints()

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

请改用 QEventPoint::setExclusiveGrabber()。释放该项拥有的触摸点。

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