diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-07-26 16:33:13 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-07-27 10:42:54 +0000 |
commit | 0e1f83dcade8cb6428513eea4452dcd500f9e486 (patch) | |
tree | 227c4848145b23fde12ad33d3bea3a60c04cb36e /src/quick/handlers/qquicktaphandler_p.h | |
parent | 447e2e024609a22fe052cf458c27efdef2e3d3eb (diff) |
Fix PointerHandler constructors and destructors
- Constructors should take QQuickItem* not QObject* to be symmetric
with the parentItem() accessor (and other code) which assumes its type
- Use header initialization everywhere possible
- Reorder variables to minimize padding (somewhat)
- Remove empty destructor bodies (the compiler can write them)
- Remove override and virtual from destructors in accordance with
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rh-override
Change-Id: I682a53a803d65e29136bfaec3a5b534e975ecf30
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quick/handlers/qquicktaphandler_p.h')
-rw-r--r-- | src/quick/handlers/qquicktaphandler_p.h | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/quick/handlers/qquicktaphandler_p.h b/src/quick/handlers/qquicktaphandler_p.h index b7c1895926..a4c5bf657e 100644 --- a/src/quick/handlers/qquicktaphandler_p.h +++ b/src/quick/handlers/qquicktaphandler_p.h @@ -75,8 +75,7 @@ public: }; Q_ENUM(GesturePolicy) - explicit QQuickTapHandler(QObject *parent = nullptr); - ~QQuickTapHandler(); + explicit QQuickTapHandler(QQuickItem *parent = nullptr); bool isPressed() const { return m_pressed; } @@ -113,14 +112,14 @@ private: void updateTimeHeld(); private: - bool m_pressed; - GesturePolicy m_gesturePolicy; - int m_tapCount; - int m_longPressThreshold; - QBasicTimer m_longPressTimer; - QElapsedTimer m_holdTimer; QPointF m_lastTapPos; - qreal m_lastTapTimestamp; + qreal m_lastTapTimestamp = 0; + QElapsedTimer m_holdTimer; + QBasicTimer m_longPressTimer; + int m_tapCount = 0; + int m_longPressThreshold = -1; + GesturePolicy m_gesturePolicy = GesturePolicy::DragThreshold; + bool m_pressed = false; static qreal m_multiTapInterval; static int m_mouseMultiClickDistanceSquared; |