| 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 QQUICKMOUSEAREA_P_P_H |
| 5 | #define QQUICKMOUSEAREA_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 "qquickitem_p.h" |
| 19 | #include "qquickevents_p_p.h" |
| 20 | |
| 21 | #include <QtGui/qevent.h> |
| 22 | #include <QtCore/qbasictimer.h> |
| 23 | |
| 24 | QT_BEGIN_NAMESPACE |
| 25 | |
| 26 | class QQuickMouseEvent; |
| 27 | class QQuickMouseArea; |
| 28 | class QQuickMouseAreaPrivate : public QQuickItemPrivate |
| 29 | { |
| 30 | Q_DECLARE_PUBLIC(QQuickMouseArea) |
| 31 | |
| 32 | public: |
| 33 | QQuickMouseAreaPrivate(); |
| 34 | ~QQuickMouseAreaPrivate(); |
| 35 | void init(); |
| 36 | |
| 37 | void saveEvent(QMouseEvent *event); |
| 38 | enum PropagateType{ |
| 39 | Click, |
| 40 | DoubleClick, |
| 41 | PressAndHold |
| 42 | }; |
| 43 | void propagate(QQuickMouseEvent* event, PropagateType); |
| 44 | bool propagateHelper(QQuickMouseEvent*, QQuickItem*,const QPointF &, PropagateType); |
| 45 | |
| 46 | bool isPressAndHoldConnected(); |
| 47 | bool isDoubleClickConnected(); |
| 48 | bool isClickConnected(); |
| 49 | #if QT_CONFIG(wheelevent) |
| 50 | bool isWheelConnected(); |
| 51 | #endif |
| 52 | |
| 53 | bool enabled : 1; |
| 54 | bool hoverEnabled : 1; |
| 55 | bool scrollGestureEnabled : 1; |
| 56 | bool hovered : 1; |
| 57 | bool longPress : 1; |
| 58 | bool moved : 1; |
| 59 | bool stealMouse : 1; |
| 60 | bool doubleClick : 1; |
| 61 | bool preventStealing : 1; |
| 62 | bool propagateComposedEvents : 1; |
| 63 | bool overThreshold : 1; |
| 64 | Qt::MouseButtons pressed; |
| 65 | int pressAndHoldInterval; |
| 66 | #if QT_CONFIG(quick_draganddrop) |
| 67 | QQuickDrag *drag; |
| 68 | #endif |
| 69 | QPointF startScene; |
| 70 | QPointF targetStartPos; |
| 71 | QPointF lastPos; |
| 72 | QQmlNullableValue<QPointF> lastScenePos; |
| 73 | Qt::MouseButton lastButton; |
| 74 | Qt::MouseButtons lastButtons; |
| 75 | Qt::KeyboardModifiers lastModifiers; |
| 76 | QBasicTimer pressAndHoldTimer; |
| 77 | #if QT_CONFIG(cursor) |
| 78 | QCursor *cursor; |
| 79 | #endif |
| 80 | QQuickMouseEvent quickMouseEvent; |
| 81 | #if QT_CONFIG(wheelevent) |
| 82 | QQuickWheelEvent quickWheelEvent; |
| 83 | #endif |
| 84 | Qt::MouseEventFlags lastFlags; |
| 85 | }; |
| 86 | |
| 87 | QT_END_NAMESPACE |
| 88 | |
| 89 | #endif // QQUICKMOUSEAREA_P_P_H |
| 90 |
