QWheelEvent Class
The QWheelEvent class contains parameters that describe a wheel event. More...
Header: | #include <QWheelEvent> |
qmake: | QT += gui |
Inherits: | QInputEvent |
Public Functions
QWheelEvent(const QPointF &pos, const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) | |
QWheelEvent(const QPointF &pos, const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase) | |
QWheelEvent(const QPointF &pos, const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source) | |
QWheelEvent(const QPointF &pos, const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source, bool inverted) | |
QWheelEvent(QPointF pos, QPointF globalPos, QPoint pixelDelta, QPoint angleDelta, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, bool inverted, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized) | |
QPoint | angleDelta() const |
Qt::MouseButtons | buttons() const |
int | delta() const |
QPoint | globalPos() const |
const QPointF & | globalPosF() const |
int | globalX() const |
int | globalY() const |
bool | inverted() const |
Qt::Orientation | orientation() const |
Qt::ScrollPhase | phase() const |
QPoint | pixelDelta() const |
QPoint | pos() const |
const QPointF & | posF() const |
Qt::MouseEventSource | source() const |
int | x() const |
int | y() const |
- 4 public functions inherited from QInputEvent
- 6 public functions inherited from QEvent
Protected Variables
uint | _unused_ |
QPoint | angleD |
QPointF | g |
bool | invertedScrolling |
Qt::MouseButtons | mouseState |
QPointF | p |
uint | ph |
QPoint | pixelD |
int | qt4D |
Qt::Orientation | qt4O |
int | reserved |
uint | src |
Additional Inherited Members
Detailed Description
The QWheelEvent class contains parameters that describe a wheel event.
Wheel events are sent to the widget under the mouse cursor, but if that widget does not handle the event they are sent to the focus widget. Wheel events are generated for both mouse wheels and trackpad scroll gestures. There are two ways to read the wheel event delta: angleDelta() returns the delta in wheel degrees. This value is always provided. pixelDelta() returns the delta in screen pixels and is available on platforms that have high-resolution trackpads, such as macOS. If that is the case, source() will return Qt::MouseEventSynthesizedBySystem.
The functions pos() and globalPos() return the mouse cursor's location at the time of the event.
A wheel event contains a special accept flag that indicates whether the receiver wants the event. You should call ignore() if you do not handle the wheel event; this ensures that it will be sent to the parent widget.
The QWidget::setEnabled() function can be used to enable or disable mouse and keyboard events for a widget.
The event handler QWidget::wheelEvent() receives wheel events.
See also QMouseEvent and QWidget::grabMouse().
Member Function Documentation
QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
Constructs a wheel event object.
The pos provides the location of the mouse cursor within the window. The position in global coordinates is specified by globalPos.
pixelDelta contains the scrolling distance in pixels on screen, while angleDelta contains the wheel rotation distance. pixelDelta is optional and can be null.
The mouse and keyboard states at the time of the event are specified by buttons and modifiers.
For backwards compatibility, the event can also hold monodirectional wheel event data: qt4Delta specifies the rotation, and qt4Orientation the direction.
The phase() is initialized to Qt::ScrollUpdate. Use the other constructor to specify the phase explicitly.
See also posF(), globalPosF(), angleDelta(), and pixelDelta().
QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase)
Constructs a wheel event object.
The pos provides the location of the mouse cursor within the window. The position in global coordinates is specified by globalPos.
pixelDelta contains the scrolling distance in pixels on screen, while angleDelta contains the wheel rotation distance. pixelDelta is optional and can be null.
The mouse and keyboard states at the time of the event are specified by buttons and modifiers.
For backwards compatibility, the event can also hold monodirectional wheel event data: qt4Delta specifies the rotation, and qt4Orientation the direction.
The scrolling phase of the event is specified by phase.
See also posF(), globalPosF(), angleDelta(), pixelDelta(), and phase().
QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source)
Constructs a wheel event object.
The pos provides the location of the mouse cursor within the window. The position in global coordinates is specified by globalPos.
pixelDelta contains the scrolling distance in pixels on screen, while angleDelta contains the wheel rotation distance. pixelDelta is optional and can be null.
The mouse and keyboard states at the time of the event are specified by buttons and modifiers.
For backwards compatibility, the event can also hold monodirectional wheel event data: qt4Delta specifies the rotation, and qt4Orientation the direction.
The scrolling phase of the event is specified by phase.
If the wheel event comes from a physical mouse wheel, source is set to Qt::MouseEventNotSynthesized. If it comes from a gesture detected by the operating system, or from a non-mouse hardware device, such that pixelDelta is directly related to finger movement, source is set to Qt::MouseEventSynthesizedBySystem. If it comes from Qt, source would be set to Qt::MouseEventSynthesizedByQt.
See also posF(), globalPosF(), angleDelta(), pixelDelta(), and phase().
QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source, bool inverted)
Constructs a wheel event object.
The pos provides the location of the mouse cursor within the window. The position in global coordinates is specified by globalPos.
pixelDelta contains the scrolling distance in pixels on screen, while angleDelta contains the wheel rotation distance. pixelDelta is optional and can be null.
The mouse and keyboard states at the time of the event are specified by buttons and modifiers.
For backwards compatibility, the event can also hold monodirectional wheel event data: qt4Delta specifies the rotation, and qt4Orientation the direction.
The scrolling phase of the event is specified by phase.
If the wheel event comes from a physical mouse wheel, source is set to Qt::MouseEventNotSynthesized. If it comes from a gesture detected by the operating system, or from a non-mouse hardware device, such that pixelDelta is directly related to finger movement, source is set to Qt::MouseEventSynthesizedBySystem. If it comes from Qt, source would be set to Qt::MouseEventSynthesizedByQt.
If the system is configured to invert the delta values delivered with the event (such as natural scrolling of the touchpad on OS X), inverted should be true
. Otherwise, inverted is false
See also posF(), globalPosF(), angleDelta(), pixelDelta(), and phase().
QWheelEvent::QWheelEvent(QPointF pos, QPointF globalPos, QPoint pixelDelta, QPoint angleDelta, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, bool inverted, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized)
Constructs a wheel event object.
The pos provides the location of the mouse cursor within the window. The position in global coordinates is specified by globalPos.
pixelDelta contains the scrolling distance in pixels on screen, while angleDelta contains the wheel rotation distance. pixelDelta is optional and can be null.
The mouse and keyboard states at the time of the event are specified by buttons and modifiers.
The scrolling phase of the event is specified by phase.
If the wheel event comes from a physical mouse wheel, source is set to Qt::MouseEventNotSynthesized. If it comes from a gesture detected by the operating system, or from a non-mouse hardware device, such that pixelDelta is directly related to finger movement, source is set to Qt::MouseEventSynthesizedBySystem. If it comes from Qt, source would be set to Qt::MouseEventSynthesizedByQt.
If the system is configured to invert the delta values delivered with the event (such as natural scrolling of the touchpad on macOS), inverted should be true
. Otherwise, inverted is false
See also posF(), globalPosF(), angleDelta(), pixelDelta(), and phase().