Krita Source Code Documentation
Loading...
Searching...
No Matches
KoPointerEvent.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2
3 SPDX-FileCopyrightText: 2006 Thorsten Zachmann <zachmann@kde.org>
4 SPDX-FileCopyrightText: 2006 C. Boemann Rasmussen <cbo@boemann.dk>
5 SPDX-FileCopyrightText: 2006-2007 Thomas Zander <zander@kde.org>
6 SPDX-FileCopyrightText: 2012 Boudewijn Rempt <boud@valdyas.org>
7
8 SPDX-License-Identifier: LGPL-2.0-or-later
9*/
10
11#ifndef KOPOINTEREVENT_H
12#define KOPOINTEREVENT_H
13
14#include <QSharedPointer>
15#include <QPointF>
16#include <optional>
17
18class QEvent;
19class QTabletEvent;
20class QMouseEvent;
21class QWheelEvent;
22class QTouchEvent;
23
24#include "kritaflake_export.h"
25
27
35class KRITAFLAKE_EXPORT KoPointerEvent
36{
37public:
44 KoPointerEvent(QMouseEvent *event, const QPointF &point);
45
52 KoPointerEvent(QTabletEvent *event, const QPointF &point);
53
54 KoPointerEvent(QTouchEvent* ev, const QPointF& pnt);
55
56 KoPointerEvent(KoPointerEvent *event, const QPointF& point);
57
59
69
76 KoPointerEvent& operator=(const KoPointerEvent &rhs);
77
85 KoPointerEventWrapper deepCopyEvent() const;
86
92 void accept();
93
99 void ignore();
100
105 Qt::KeyboardModifiers modifiers() const;
106
108 bool isAccepted() const;
109
111 bool spontaneous() const;
112
114 Qt::MouseButton button() const;
115
117 Qt::MouseButtons buttons() const;
118
120 QPoint globalPos() const;
121
123 QPoint pos() const;
124
130 qreal pressure() const;
131
133 qreal rotation() const;
134
142 qreal tangentialPressure() const;
143
148 int x() const;
149
156 qreal xTilt() const;
157
162 int y() const;
163
170 qreal yTilt() const;
171
177 int z() const;
178
182 ulong time() const;
183
184
186 QPointF point;
187
191 bool isTabletEvent() const;
192
196 bool isTouchEvent() const;
197
201 static bool tabletInputReceived();
202
203public:
204#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
205 static void copyQtPointerEvent(const QMouseEvent *event, QScopedPointer<QEvent> &dst);
206 static void copyQtPointerEvent(const QTabletEvent *event, QScopedPointer<QEvent> &dst);
207 static void copyQtPointerEvent(const QTouchEvent *event, QScopedPointer<QEvent> &dst);
208#endif
209
210 static std::optional<QPointF> fetchGlobalPositionFromPointerEvent(QEvent *event);
211
212protected:
213 friend class KoToolProxy;
214 friend class KisToolProxy;
216private:
217
218 class Private;
219 const QScopedPointer<Private> d;
220};
221
222struct KRITAFLAKE_EXPORT KoPointerEventWrapper
223{
224 template <typename Event>
225 KoPointerEventWrapper(Event *_event, const QPointF &point);
226
229};
230
231#endif
232
const QScopedPointer< Private > d
QPointF point
The point in document coordinates.
QString button(const QWheelEvent &ev)
QString buttons(const T &ev)
QSharedPointer< QEvent > baseQtEvent