diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-01-15 01:00:38 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-01-15 01:00:39 +0100 |
commit | c3123c757a2301445ac286ce2c8af20959151e21 (patch) | |
tree | c8f5421725d0fe0cfe8a29136937e54d6f3f95c2 /src/gui/kernel/qevent.cpp | |
parent | 2cbc5f6f7ae8ba580126a7cafc1898377c2a2407 (diff) | |
parent | 7a59d6f138ff8799170cc03d709525ab965d703a (diff) | |
download | qtbase-c3123c757a2301445ac286ce2c8af20959151e21.tar.gz |
Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I8dbcf23835d52d3aa7d018ed250814d60c68aa83
Diffstat (limited to 'src/gui/kernel/qevent.cpp')
-rw-r--r-- | src/gui/kernel/qevent.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index c69cc8ce6f..3362294435 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -667,9 +667,9 @@ QHoverEvent::~QHoverEvent() 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 + wheel event delta: angleDelta() returns the deltas in wheel + degrees. These values are always provided. pixelDelta() returns + the deltas 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. @@ -852,7 +852,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, by \a globalPos. \a pixelDelta contains the scrolling distance in pixels on screen, while - \a angleDelta contains the wheel rotation distance. \a pixelDelta is + \a angleDelta contains the wheel rotation angle. \a pixelDelta is optional and can be null. The mouse and keyboard states at the time of the event are specified by @@ -914,10 +914,16 @@ QWheelEvent::~QWheelEvent() /*! \fn QPoint QWheelEvent::angleDelta() const - Returns the distance that the wheel is rotated, in eighths of a - degree. A positive value indicates that the wheel was rotated - forwards away from the user; a negative value indicates that the - wheel was rotated backwards toward the user. + Returns the relative amount that the wheel was rotated, in eighths of a + degree. A positive value indicates that the wheel was rotated forwards away + from the user; a negative value indicates that the wheel was rotated + backwards toward the user. \c angleDelta().y() provides the angle through + which the common vertical mouse wheel was rotated since the previous event. + \c angleDelta().x() provides the angle through which the horizontal mouse + wheel was rotated, if the mouse has a horizontal wheel; otherwise it stays + at zero. Some mice allow the user to tilt the wheel to perform horizontal + scrolling, and some touchpads support a horizontal scrolling gesture; that + will also appear in \c angleDelta().x(). Most mouse types work in steps of 15 degrees, in which case the delta value is a multiple of 120; i.e., 120 units * 1/8 = 15 degrees. @@ -926,7 +932,9 @@ QWheelEvent::~QWheelEvent() that are less than 120 units (less than 15 degrees). To support this possibility, you can either cumulatively add the delta values from events until the value of 120 is reached, then scroll the widget, or you can - partially scroll the widget in response to each wheel event. + partially scroll the widget in response to each wheel event. But to + provide a more native feel, you should prefer \l pixelDelta() on platforms + where it's available. Example: @@ -937,6 +945,8 @@ QWheelEvent::~QWheelEvent() \li scrolling is about to begin, but the distance did not yet change (Qt::ScrollBegin), \li or scrolling has ended and the distance did not change anymore (Qt::ScrollEnd). \endlist + + \see pixelDelta() */ /*! |