diff options
author | Shawn Rutledge <shawn.rutledge@theqtcompany.com> | 2016-07-12 18:54:50 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2016-07-13 08:58:33 +0000 |
commit | 909b37e45ec24234c2aecfb211fdc2dc4fe520b6 (patch) | |
tree | e2d7c788f1d91809e83fec93870eb72be77fa678 /src/quick/items/qquickevents_p_p.h | |
parent | 03305d33482b1447da2df8425f131477dd146064 (diff) |
QQuickPointerEvent: make bool test functions public; use for bool tests
Maybe if (isTouchEvent()) is more efficient than if (asTouchEvent()).
Change-Id: Ie3e216ff5c9b512abc4a25690f98cb948e8b5399
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Diffstat (limited to 'src/quick/items/qquickevents_p_p.h')
-rw-r--r-- | src/quick/items/qquickevents_p_p.h | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h index 04f43667a7..ae55f2f399 100644 --- a/src/quick/items/qquickevents_p_p.h +++ b/src/quick/items/qquickevents_p_p.h @@ -419,9 +419,14 @@ public: * Returns nullptr in case the original event was not a mouse event. */ QMouseEvent *asMouseEvent() const; - int pointCount() const { return asTouchEvent() ? m_touchPoints.count() : 1; } + bool isMouseEvent() const; + bool isTouchEvent() const; + bool isTabletEvent() const; + bool isValid() const { return m_event != nullptr; } + + int pointCount() const { return isTouchEvent() ? m_touchPoints.count() : 1; } const QQuickEventPoint *point(int i) const { - if (asTouchEvent()) + if (isTouchEvent()) return m_touchPoints.at(i); return i == 0 ? m_mousePoint : nullptr; } @@ -431,13 +436,6 @@ public: QTouchEvent *touchEventForItem(const QList<const QQuickEventPoint *> &newPoints, QQuickItem *relativeTo) const; protected: - bool isValid() const { return m_event != nullptr; } - -protected: - bool isMouseEvent() const; - bool isTouchEvent() const; - bool isTabletEvent() const; - const QQuickPointerDevice *m_device; QInputEvent *m_event; // original event as received by QQuickWindow Qt::MouseButton m_button; |