QGraphicsSceneWheelEvent Class

QGraphicsSceneWheelEvent 类提供图形视图框架中的滚轮事件。更多

Header: #include <QGraphicsSceneWheelEvent>
CMake: find_package(Qt6 REQUIRED COMPONENTS Widgets)
target_link_libraries(mytarget PRIVATE Qt6::Widgets)
qmake: QT += widgets
继承: QGraphicsSceneEvent

公共函数

virtual ~QGraphicsSceneWheelEvent()
Qt::MouseButtons buttons() const
int delta() const
(since 6.2) bool isInverted() const
Qt::KeyboardModifiers modifiers() const
Qt::Orientation orientation() const
(since 6.2) Qt::ScrollPhase phase() const
(since 6.2) QPoint pixelDelta() const
QPointF pos() const
QPointF scenePos() const
QPoint screenPos() const

详细说明

QWheelEventQWheelEvent::globalPos() 将QGraphicsView 接收到的 QWheelEvent 转换为 QGraphicsSceneWheelEvents;它将 QWheelEvent::globalPos() 转换为项目、场景和屏幕坐标 (pos(),scenePos(), 和screenPos()) 。

另请参见 QGraphicsSceneMouseEvent,QGraphicsSceneContextMenuEvent,QGraphicsSceneHoverEvent, 和QWheelEvent

成员函数文档

[virtual noexcept] QGraphicsSceneWheelEvent::~QGraphicsSceneWheelEvent()

摧毁QGraphicsSceneWheelEvent.

Qt::MouseButtons QGraphicsSceneWheelEvent::buttons() const

返回滚轮事件发生时按下的鼠标键。

另请参阅 modifiers().

int QGraphicsSceneWheelEvent::delta() const

返回车轮旋转的距离,单位为八分之一 (1/8s)。正值表示滚轮向前旋转,远离用户;负值表示滚轮向后旋转,朝向用户。

大多数鼠标类型以 15 度为单位,在这种情况下,delta 值是 120 的倍数(== 15 * 8)。

[since 6.2] bool QGraphicsSceneWheelEvent::isInverted() const

返回事件传递的 delta 值是否反转。

此函数在 Qt 6.2 中引入。

Qt::KeyboardModifiers QGraphicsSceneWheelEvent::modifiers() const

返回滚轮事件发生时处于活动状态的键盘修改器。

另请参阅 buttons()。

Qt::Orientation QGraphicsSceneWheelEvent::orientation() const

返回车轮方向。

[since 6.2] Qt::ScrollPhase QGraphicsSceneWheelEvent::phase() const

返回此滚轮事件的滚动阶段。

此函数在 Qt 6.2 中引入。

另请参阅 QWheelEvent::phase

[since 6.2] QPoint QGraphicsSceneWheelEvent::pixelDelta() const

以像素为单位返回屏幕上的滚动距离。该值在支持基于高分辨率像素的 delta 值的平台(如 macOS)上提供。该值应直接用于滚动屏幕上的内容。

此函数在 Qt 6.2 中引入。

另请参阅 QWheelEvent::pixelDelta

QPointF QGraphicsSceneWheelEvent::pos() const

返回滚轮事件发生时光标在项目坐标中的位置。

另请参阅 scenePos() 和screenPos()。

QPointF QGraphicsSceneWheelEvent::scenePos() const

返回滚轮事件发生时光标在场景坐标中的位置。

另请参阅 pos() 和screenPos()。

QPoint QGraphicsSceneWheelEvent::screenPos() const

返回滚轮事件发生时光标在屏幕坐标中的位置。

另请参阅 pos() 和scenePos()。

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