summaryrefslogtreecommitdiffstats
path: root/examples/gestures/imageviewer/tapandholdgesture.h
diff options
context:
space:
mode:
Diffstat (limited to 'examples/gestures/imageviewer/tapandholdgesture.h')
-rw-r--r--examples/gestures/imageviewer/tapandholdgesture.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/examples/gestures/imageviewer/tapandholdgesture.h b/examples/gestures/imageviewer/tapandholdgesture.h
new file mode 100644
index 0000000000..711a1af4cc
--- /dev/null
+++ b/examples/gestures/imageviewer/tapandholdgesture.h
@@ -0,0 +1,32 @@
+#ifndef TAPANDHOLDGESTURE_H
+#define TAPANDHOLDGESTURE_H
+
+#include <QtCore/QBasicTimer>
+#include <QtGui/QGesture>
+#include <QtGui/QWidget>
+
+class TapAndHoldGesture : public QGesture
+{
+ Q_OBJECT
+ Q_PROPERTY(QPoint pos READ pos)
+
+public:
+ TapAndHoldGesture(QWidget *parent);
+
+ bool filterEvent(QEvent *event);
+ void reset();
+
+ QPoint pos() const;
+
+protected:
+ void timerEvent(QTimerEvent *event);
+
+private:
+ QBasicTimer timer;
+ int iteration;
+ QPoint position;
+ static const int iterationCount;
+ static const int iterationTimeout;
+};
+
+#endif // TAPANDHOLDGESTURE_H