diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-03-22 07:24:57 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-03-22 07:28:42 +0100 |
commit | a02863234d76abb6c9f289026ae4ea3145924f30 (patch) | |
tree | aef6381d0000a78ba69ac80eb03739b1c8ca5fc3 /src/gui/kernel/qevent.cpp | |
parent | e77b13621f0057374d83a2b884f03dd2e5b7b88c (diff) | |
parent | e4d79e1fdeb6b26ba0b12b578daacf7cd672b960 (diff) |
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
configure
mkspecs/common/wince/qplatformdefs.h
src/plugins/platforms/directfb/qdirectfbbackingstore.cpp
src/plugins/platforms/xcb/qxcbbackingstore.cpp
Change-Id: Ied4d31264a9afca9514b51a7eb1494c28712793c
Diffstat (limited to 'src/gui/kernel/qevent.cpp')
-rw-r--r-- | src/gui/kernel/qevent.cpp | 82 |
1 files changed, 74 insertions, 8 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 34387d95d8..2b3b153537 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -702,6 +702,31 @@ QHoverEvent::~QHoverEvent() */ /*! + \fn bool QWheelEvent::inverted() const + \since 5.7 + + Returns whether the delta values delivered with the event are inverted. + + Normally, a vertical wheel will produce a QWheelEvent with positive delta + values if the top of the wheel is rotating away from the hand operating it. + Similarly, a horizontal wheel movement will produce a QWheelEvent with + positive delta values if the top of the wheel is moved to the left. + + However, on some platforms this is configurable, so that the same + operations described above will produce negative delta values (but with the + same magnitude). With the inverted property a wheel event consumer can + choose to always follow the direction of the wheel, regardless of the + system settings, but only for specific widgets. (One such use case could be + that the user is rotating the wheel in the same direction as a visual + Tumbler rotates. Another usecase is to make a slider handle follow the + direction of movement of fingers on a touchpad regardless of system + configuration.) + + \note Many platforms provide no such information. On such platforms + \l inverted always returns false. +*/ + +/*! \fn Qt::Orientation QWheelEvent::orientation() const \obsolete @@ -734,7 +759,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, int delta, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::Orientation orient) : QInputEvent(Wheel, modifiers), p(pos), qt4D(delta), qt4O(orient), mouseState(buttons), - ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized) + ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized), invertedScrolling(false) { g = QCursor::pos(); if (orient == Qt::Vertical) @@ -769,7 +794,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::Orientation orient) : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), qt4D(delta), qt4O(orient), mouseState(buttons), - ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized) + ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized), invertedScrolling(false) { if (orient == Qt::Vertical) angleD = QPoint(0, delta); @@ -806,7 +831,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta), angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(Qt::NoScrollPhase), - src(Qt::MouseEventNotSynthesized) + src(Qt::MouseEventNotSynthesized), invertedScrolling(false) {} /*! @@ -837,15 +862,14 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase) : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta), angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase), - src(Qt::MouseEventNotSynthesized) + src(Qt::MouseEventNotSynthesized), invertedScrolling(false) {} /*! Constructs a wheel event object. - The \a pos provides the location of the mouse cursor - within the window. The position in global coordinates is specified - by \a globalPos. + The \a pos provides the location of the mouse cursor within the window. The + position in global coordinates is specified by \a globalPos. \a pixelDelta contains the scrolling distance in pixels on screen, while \a angleDelta contains the wheel rotation distance. \a pixelDelta is @@ -873,7 +897,49 @@ 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) : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta), - angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase), src(source) + angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase), src(source), + invertedScrolling(false) +{} + +/*! + Constructs a wheel event object. + + The \a pos provides the location of the mouse cursor + within the window. The position in global coordinates is specified + by \a globalPos. + + \a pixelDelta contains the scrolling distance in pixels on screen, while + \a angleDelta contains the wheel rotation distance. \a pixelDelta is + optional and can be null. + + The mouse and keyboard states at the time of the event are specified by + \a buttons and \a modifiers. + + For backwards compatibility, the event can also hold monodirectional wheel + event data: \a qt4Delta specifies the rotation, and \a qt4Orientation the + direction. + + The scrolling phase of the event is specified by \a phase. + + If the wheel event comes from a physical mouse wheel, \a 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 \a + pixelDelta is directly related to finger movement, \a 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), \a inverted + should be \c true. Otherwise, \a inverted is \c false + + \sa posF(), globalPosF(), angleDelta(), pixelDelta(), 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) + : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta), + angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase), src(source), + invertedScrolling(inverted) {} #endif // QT_NO_WHEELEVENT |