summaryrefslogtreecommitdiffstats
path: root/examples/gestures/imageviewer/tapandholdgesture.h
blob: 711a1af4ccf2fda5480f4a178c2a214af9c0babf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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