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
23QT_BEGIN_NAMESPACE
24
25class QPointingDevice;
26
27class Q_GUI_EXPORT QMutableTouchEvent : public QTouchEvent
28{
29public:
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
43 void addPoint(const QEventPoint &point);
44};
45
46class Q_GUI_EXPORT QMutableSinglePointEvent : public QSinglePointEvent
47{
48public:
49 QMutableSinglePointEvent(const QSinglePointEvent &other) : QSinglePointEvent(other) {}
50 QMutableSinglePointEvent(Type type = QEvent::None, const QPointingDevice *device = nullptr, const QEventPoint &point = QEventPoint(),
51 Qt::MouseButton button = Qt::NoButton, Qt::MouseButtons buttons = Qt::NoButton,
52 Qt::KeyboardModifiers modifiers = Qt::NoModifier,
53 Qt::MouseEventSource source = Qt::MouseEventSynthesizedByQt) :
54 QSinglePointEvent(type, device, point, button, buttons, modifiers, source) { }
55 ~QMutableSinglePointEvent() override;
56
57 static QMutableSinglePointEvent *from(QSinglePointEvent *e) { return static_cast<QMutableSinglePointEvent *>(e); }
58
59 static QMutableSinglePointEvent &from(QSinglePointEvent &e) { return static_cast<QMutableSinglePointEvent &>(e); }
60
61 void setSource(Qt::MouseEventSource s) { m_source = s; }
62
63 bool isDoubleClick() { return m_doubleClick; }
64
65 void setDoubleClick(bool d = true) { m_doubleClick = d; }
66};
67
68QT_END_NAMESPACE
69
70#endif // QEVENT_P_H
71

source code of qtbase/src/gui/kernel/qevent_p.h