diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-09-14 16:13:16 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-09-17 19:03:24 +0200 |
commit | 153dcfbbba822390ccb7109499088cc954100a26 (patch) | |
tree | 281f214916317d321fed680428b371e8ae9910b7 /src/gui/kernel/qevent.h | |
parent | 55a7dd458102d63ba6c21a3a5ec7c3365653405e (diff) |
Rename is[Begin|Update|End]Event, reimplement in QWheelEvent
These states correspond well with ScrollPhase, and this abstraction
makes it possible to handle wheel events the same way as mouse events
in Qt Quick: on "begin" we deliver to all Items and Handlers until
all points (the only point) are accepted; on "update" and "end" we
deliver only to the exclusive grabber, if there is one, and to any
passive grabbers.
Change-Id: I702dbd4f2c1bf5962eb3dbb9e4b725300a00a887
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui/kernel/qevent.h')
-rw-r--r-- | src/gui/kernel/qevent.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index ab87fc3c4b..190959cb16 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -210,9 +210,9 @@ public: const QList<QEventPoint> &points() const { return m_points; } QEventPoint *pointById(int id); bool allPointsGrabbed() const; - virtual bool isPressEvent() const { return false; } + virtual bool isBeginEvent() const { return false; } virtual bool isUpdateEvent() const { return false; } - virtual bool isReleaseEvent() const { return false; } + virtual bool isEndEvent() const { return false; } bool allPointsAccepted() const; QObject *exclusiveGrabber(const QEventPoint &point) const; void setExclusiveGrabber(const QEventPoint &point, QObject *exclusiveGrabber); @@ -243,9 +243,9 @@ public: inline QPointF globalPosition() const { Q_ASSERT(!m_points.isEmpty()); return m_points.first().globalPosition(); } - bool isPressEvent() const override; + bool isBeginEvent() const override; bool isUpdateEvent() const override; - bool isReleaseEvent() const override; + bool isEndEvent() const override; protected: QSinglePointEvent(Type type, const QPointingDevice *dev, const QEventPoint &point, @@ -392,6 +392,9 @@ public: inline bool isInverted() const { return m_invertedScrolling; } inline bool hasPixelDelta() const { return !m_pixelDelta.isNull(); } + bool isBeginEvent() const override; + bool isUpdateEvent() const override; + bool isEndEvent() const override; Qt::MouseEventSource source() const { return Qt::MouseEventSource(m_source); } protected: @@ -996,9 +999,9 @@ public: QT_DEPRECATED_VERSION_X_6_0("Use points()") const QList<QEventPoint> &touchPoints() const { return points(); } #endif - bool isPressEvent() const override; + bool isBeginEvent() const override; bool isUpdateEvent() const override; - bool isReleaseEvent() const override; + bool isEndEvent() const override; protected: QObject *m_target = nullptr; |