1 | // Copyright (C) 2021 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 QQUICKPRESSHANDLER_P_P_H |
5 | #define QQUICKPRESSHANDLER_P_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <QtCore/qpoint.h> |
19 | #include <QtCore/qbasictimer.h> |
20 | #include <QtCore/private/qglobal_p.h> |
21 | |
22 | #include <memory> |
23 | |
24 | QT_BEGIN_NAMESPACE |
25 | |
26 | class QQuickItem; |
27 | class QMouseEvent; |
28 | class QTimerEvent; |
29 | |
30 | struct QQuickPressHandler |
31 | { |
32 | void mousePressEvent(QMouseEvent *event); |
33 | void mouseMoveEvent(QMouseEvent *event); |
34 | void mouseReleaseEvent(QMouseEvent *event); |
35 | void timerEvent(QTimerEvent *event); |
36 | |
37 | void clearDelayedMouseEvent(); |
38 | bool isActive(); |
39 | |
40 | static bool isSignalConnected(QQuickItem *item, const char *signalName, int &signalIndex); |
41 | |
42 | QQuickItem *control = nullptr; |
43 | QBasicTimer timer; |
44 | QPointF pressPos; |
45 | bool longPress = false; |
46 | int pressAndHoldSignalIndex = -1; |
47 | int pressedSignalIndex = -1; |
48 | int releasedSignalIndex = -1; |
49 | std::unique_ptr<QMouseEvent> delayedMousePressEvent = nullptr; |
50 | }; |
51 | |
52 | QT_END_NAMESPACE |
53 | |
54 | #endif // QQUICKPRESSHANDLER_P_P_H |
55 | |