本页内容

QGraphicsSceneWheelEvent Class

QGraphicsSceneWheelEvent 类在图形视图框架中提供了滚轮事件。更多内容...

头文件: #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

详细说明

QWheelEvent QGraphicsView 接收的事件会被转换为 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/8)。正值表示滚轮向前旋转(远离用户);负值表示滚轮向后旋转(朝向用户)。

大多数鼠标以 15 度为步长,此时 delta 值是 120 的倍数(== 15 * 8)。

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

返回事件随附的增量值是否为反相的。

该函数在 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

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

该函数于 Qt 6.2 中引入。

另请参阅 QWheelEvent::pixelDelta 。

QPointF QGraphicsSceneWheelEvent::pos() const

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

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

QPointF QGraphicsSceneWheelEvent::scenePos() const

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

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

QPoint QGraphicsSceneWheelEvent::screenPos() const

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

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

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