1 | // Copyright (C) 2020 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 QEVENT_P_H |
5 | #define QEVENT_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 for the convenience |
12 | // of other Qt classes. 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 <QtGui/private/qtguiglobal_p.h> |
19 | #include <QtCore/qurl.h> |
20 | #include <QtGui/qevent.h> |
21 | #include <QtGui/qwindow.h> |
22 | |
23 | QT_BEGIN_NAMESPACE |
24 | |
25 | class QPointingDevice; |
26 | |
27 | class Q_GUI_EXPORT QMutableTouchEvent : public QTouchEvent |
28 | { |
29 | public: |
30 | QMutableTouchEvent(QEvent::Type eventType = QEvent::TouchBegin, |
31 | const QPointingDevice *device = nullptr, |
32 | Qt::KeyboardModifiers modifiers = Qt::NoModifier, |
33 | const QList<QEventPoint> &touchPoints = QList<QEventPoint>()) : |
34 | QTouchEvent(eventType, device, modifiers, touchPoints) { } |
35 | ~QMutableTouchEvent() override; |
36 | |
37 | static QMutableTouchEvent *from(QTouchEvent *e) { return static_cast<QMutableTouchEvent *>(e); } |
38 | |
39 | static QMutableTouchEvent &from(QTouchEvent &e) { return static_cast<QMutableTouchEvent &>(e); } |
40 | |
41 | void setTarget(QObject *target) { m_target = target; } |
42 | void addPoint(const QEventPoint &point); |
43 | |
44 | static void setTarget(QTouchEvent *e, QObject *target) { e->m_target = target; } |
45 | static void addPoint(QTouchEvent *e, const QEventPoint &point); |
46 | }; |
47 | |
48 | class Q_GUI_EXPORT QMutableSinglePointEvent : public QSinglePointEvent |
49 | { |
50 | public: |
51 | QMutableSinglePointEvent(const QSinglePointEvent &other) : QSinglePointEvent(other) {} |
52 | QMutableSinglePointEvent(Type type = QEvent::None, const QPointingDevice *device = nullptr, const QEventPoint &point = QEventPoint(), |
53 | Qt::MouseButton button = Qt::NoButton, Qt::MouseButtons buttons = Qt::NoButton, |
54 | Qt::KeyboardModifiers modifiers = Qt::NoModifier, |
55 | Qt::MouseEventSource source = Qt::MouseEventSynthesizedByQt) : |
56 | QSinglePointEvent(type, device, point, button, buttons, modifiers, source) { } |
57 | ~QMutableSinglePointEvent() override; |
58 | |
59 | static QMutableSinglePointEvent *from(QSinglePointEvent *e) { return static_cast<QMutableSinglePointEvent *>(e); } |
60 | |
61 | static QMutableSinglePointEvent &from(QSinglePointEvent &e) { return static_cast<QMutableSinglePointEvent &>(e); } |
62 | |
63 | void setSource(Qt::MouseEventSource s) { m_source = s; } |
64 | |
65 | bool isDoubleClick() { return m_doubleClick; } |
66 | |
67 | void setDoubleClick(bool d = true) { m_doubleClick = d; } |
68 | |
69 | static bool isDoubleClick(const QSinglePointEvent *ev) |
70 | { |
71 | return ev->m_doubleClick; |
72 | } |
73 | |
74 | static void setDoubleClick(QSinglePointEvent *ev, bool d) |
75 | { |
76 | ev->m_doubleClick = d; |
77 | } |
78 | }; |
79 | |
80 | QT_END_NAMESPACE |
81 | |
82 | #endif // QEVENT_P_H |
83 | |