src/hbcore/gestures/hbtapandholdgesture.cpp
changeset 1 f7ac710697a9
parent 0 16d8024aca5e
child 2 06ff229162e9
--- a/src/hbcore/gestures/hbtapandholdgesture.cpp	Mon Apr 19 14:02:13 2010 +0300
+++ b/src/hbcore/gestures/hbtapandholdgesture.cpp	Mon May 03 12:48:33 2010 +0300
@@ -23,14 +23,11 @@
 **
 ****************************************************************************/
 
+#include "hbgestures_p.h"
 #include "hbtapandholdgesture_p.h"
 #include "hbtapandholdgesture.h"
 
-#include <QGraphicsSceneEvent>
-#include <QVariant>
-#include <QDebug>
-#include <QPoint>
-#include <QLine>
+#include <QObject>
 
 /*!
     \internal
@@ -41,9 +38,17 @@
 
 HbTapAndHoldGesture::HbTapAndHoldGesture(QObject* parent)
     :
+    QTapAndHoldGesture(parent)
+{
+    priv = new HbTapAndHoldGesturePrivate(this);
+}
+
+HbTapAndHoldGesture::HbTapAndHoldGesture(HbTapAndHoldGesturePrivate* data, QObject* parent)
+    :
     QTapAndHoldGesture(parent),
-    priv(new HbTapAndHoldGesturePrivate())
+    priv(data)
 {
+    priv->q_ptr = this;
 }
 
 HbTapAndHoldGesture::~HbTapAndHoldGesture()
@@ -51,26 +56,12 @@
     delete priv; priv = NULL;
 }
 
-/*!
-    \internal
-    \brief Stores relevant values from the event.
-    \param event Event to be read.
-
-    Gesture needs to know its position all the time, and that information
-    is provided during the event.
-*/
-void HbTapAndHoldGesture::update(QEvent& event)
+QPointF HbTapAndHoldGesture::scenePosition() const
 {
-    if ( event.type() != QEvent::Timer )
-    {
-        QGraphicsSceneMouseEvent* me = static_cast<QGraphicsSceneMouseEvent*>(&event);
-        setProperty("position", me ? me->screenPos() : property("startPos"));
-    }
+    return priv->mScenePos;
 }
 
-bool HbTapAndHoldGesture::outsideThreshold()
+void HbTapAndHoldGesture::setScenePosition(const QPointF& pos)
 {
-    QPointF startPos = property("startPos").toPoint();
-    QPointF lastPos = property("position").toPoint();
-    return QLineF(startPos, lastPos).length() > DELTA_TOLERANCE;
+    priv->mScenePos = pos;
 }