1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QGESTURERECOGNIZER_H
5#define QGESTURERECOGNIZER_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtCore/qnamespace.h>
9
10#ifndef QT_NO_GESTURES
11
12QT_BEGIN_NAMESPACE
13
14
15class QObject;
16class QEvent;
17class QGesture;
18class Q_WIDGETS_EXPORT QGestureRecognizer
19{
20public:
21 enum ResultFlag
22 {
23 Ignore = 0x0001,
24
25 MayBeGesture = 0x0002,
26 TriggerGesture = 0x0004,
27 FinishGesture = 0x0008,
28 CancelGesture = 0x0010,
29
30 ResultState_Mask = 0x00ff,
31
32 ConsumeEventHint = 0x0100,
33 // StoreEventHint = 0x0200,
34 // ReplayStoredEventsHint = 0x0400,
35 // DiscardStoredEventsHint = 0x0800,
36
37 ResultHint_Mask = 0xff00
38 };
39 Q_DECLARE_FLAGS(Result, ResultFlag)
40
41 QGestureRecognizer();
42 virtual ~QGestureRecognizer();
43
44 virtual QGesture *create(QObject *target);
45 virtual Result recognize(QGesture *state, QObject *watched,
46 QEvent *event) = 0;
47 virtual void reset(QGesture *state);
48
49 static Qt::GestureType registerRecognizer(QGestureRecognizer *recognizer);
50 static void unregisterRecognizer(Qt::GestureType type);
51};
52
53Q_DECLARE_OPERATORS_FOR_FLAGS(QGestureRecognizer::Result)
54
55QT_END_NAMESPACE
56
57#endif // QT_NO_GESTURES
58
59#endif // QGESTURERECOGNIZER_H
60

source code of qtbase/src/widgets/kernel/qgesturerecognizer.h