QPointerEvent Class
指针事件的基类。更多内容...
| 头文件: | #include <QPointerEvent> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Gui) target_link_libraries(mytarget PRIVATE Qt6::Gui) |
| qmake: | QT += gui |
| 自: | Qt 6.0 |
| 继承自: | QInputEvent |
| 被继承于: |
公共函数
| bool | addPassiveGrabber(const QEventPoint &point, QObject *grabber) |
| bool | allPointsAccepted() const |
| bool | allPointsGrabbed() const |
| void | clearPassiveGrabbers(const QEventPoint &point) |
| QObject * | exclusiveGrabber(const QEventPoint &point) const |
| QList<QPointer<QObject>> | passiveGrabbers(const QEventPoint &point) const |
| QEventPoint & | point(qsizetype i) |
| QEventPoint * | pointById(int id) |
| qsizetype | pointCount() const |
| QPointingDevice::PointerType | pointerType() const |
| const QPointingDevice * | pointingDevice() const |
| const QList<QEventPoint> & | points() const |
| bool | removePassiveGrabber(const QEventPoint &point, QObject *grabber) |
| void | setExclusiveGrabber(const QEventPoint &point, QObject *exclusiveGrabber) |
重新实现的公共函数
| virtual void | setAccepted(bool accepted) override |
受保护函数
| QPointerEvent(QPointerEvent &&) | |
| QPointerEvent & | operator=(QPointerEvent &&) |
| QPointerEvent & | operator=(const QPointerEvent &other) |
成员函数文档
[protected delete] QPointerEvent::QPointerEvent(QPointerEvent &&)
通过`move`构造一个QPointerEvent 实例。该函数已被删除。
bool QPointerEvent::addPassiveGrabber(const QEventPoint &point, QObject *grabber)
告知分发逻辑,指定的grabber 将接收所有未来的更新事件以及包含指定point 的释放事件,无论这些事件可能被分发到其他何处。
此功能仅供Qt Quick 输入处理程序使用。
如果grabber 已被添加,则返回false ;否则返回true 。
bool QPointerEvent::allPointsAccepted() const
如果对于points()中的每个点,isPointAccepted()的返回结果均为true ,则返回true ;否则返回false 。
bool QPointerEvent::allPointsGrabbed() const
如果points()中的每个点要么有一个exclusiveGrabber(),要么有一个或多个passiveGrabbers(),则返回true 。
void QPointerEvent::clearPassiveGrabbers(const QEventPoint &point)
从指定的point 中移除所有被动抓取器。
该函数仅供Qt Quick 输入处理程序使用。
另请参阅 QPointerEvent::addPassiveGrabber()。
QObject *QPointerEvent::exclusiveGrabber(const QEventPoint &point) const
返回一个已配置为接收所有未来更新事件以及包含给定point 的释放事件的对象。
目前该函数主要用于Qt Quick 。
另请参阅 setExclusiveGrabber()。
QList<QPointer<QObject>> QPointerEvent::passiveGrabbers(const QEventPoint &point) const
返回已请求接收所有未来更新事件的对象列表,以及包含给定point 的释放事件。
该函数仅供Qt Quick 输入处理程序使用。
另请参阅 QPointerEvent::addPassiveGrabber()。
QEventPoint &QPointerEvent::point(qsizetype i)
返回索引为i 的点的QEventPoint 引用。
QEventPoint *QPointerEvent::pointById(int id)
返回其id 与给定的id 匹配的点;若未找到此类点,则返回nullptr 。
qsizetype QPointerEvent::pointCount() const
返回此指针事件中的点数。
QPointingDevice::PointerType QPointerEvent::pointerType() const
返回触发该事件的点的类型。
const QPointingDevice *QPointerEvent::pointingDevice() const
返回该事件的源设备。
这与QInputEvent::device() 相同,但为了方便起见进行了类型转换。
const QList<QEventPoint> &QPointerEvent::points() const
返回此指针事件中的点列表。
bool QPointerEvent::removePassiveGrabber(const QEventPoint &point, QObject *grabber)
如果之前曾向给定的point 添加过被动grabber ,则将其移除。如果该 之前曾是被动 ,则返回true ;否则返回false 。
该函数仅供Qt Quick 输入处理程序使用。
另请参阅 QPointerEvent::addPassiveGrabber()。
[override virtual] void QPointerEvent::setAccepted(bool accepted)
void QPointerEvent::setExclusiveGrabber(const QEventPoint &point, QObject *exclusiveGrabber)
告知分发逻辑:指定的exclusiveGrabber 将接收所有未来的更新事件以及包含指定point 的释放事件,并且可以跳过向其他项的分发。
目前该功能主要用于Qt Quick 。
另请参阅 exclusiveGrabber()。
[protected delete] QPointerEvent &QPointerEvent::operator=(QPointerEvent &&)
将other 按移动赋值方式赋值给此QPointerEvent 实例。该函数已被删除。
[noexcept protected default] QPointerEvent &QPointerEvent::operator=(const QPointerEvent &other)
将other 复制并赋值给此QPointerEvent 实例。
© 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.