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
17class QEvent;
18class QTabletEvent;
19class QMouseEvent;
20class QWheelEvent;
21class QTouchEvent;
22
23#include "kritaflake_export.h"
24
26
34class KRITAFLAKE_EXPORT KoPointerEvent
35{
36public:
43 KoPointerEvent(QMouseEvent *event, const QPointF &point);
44
51 KoPointerEvent(QTabletEvent *event, const QPointF &point);
52
53 KoPointerEvent(QTouchEvent* ev, const QPointF& pnt);
54
55 KoPointerEvent(KoPointerEvent *event, const QPointF& point);
56
58
68
75 KoPointerEvent& operator=(const KoPointerEvent &rhs);
76
84 KoPointerEventWrapper deepCopyEvent() const;
85
91 void accept();
92
98 void ignore();
99
104 Qt::KeyboardModifiers modifiers() const;
105
107 bool isAccepted() const;
108
110 bool spontaneous() const;
111
113 Qt::MouseButton button() const;
114
116 Qt::MouseButtons buttons() const;
117
119 QPoint globalPos() const;
120
122 QPoint pos() const;
123
129 qreal pressure() const;
130
132 qreal rotation() const;
133
141 qreal tangentialPressure() const;
142
147 int x() const;
148
155 qreal xTilt() const;
156
161 int y() const;
162
169 qreal yTilt() const;
170
176 int z() const;
177
181 ulong time() const;
182
183
185 QPointF point;
186
190 bool isTabletEvent() const;
191
195 bool isTouchEvent() const;
196
200 static bool tabletInputReceived();
201
202public:
203#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
204 static void copyQtPointerEvent(const QMouseEvent *event, QScopedPointer<QEvent> &dst);
205 static void copyQtPointerEvent(const QTabletEvent *event, QScopedPointer<QEvent> &dst);
206 static void copyQtPointerEvent(const QTouchEvent *event, QScopedPointer<QEvent> &dst);
207#endif
208
209protected:
210 friend class KoToolProxy;
211 friend class KisToolProxy;
213private:
214
215 class Private;
216 const QScopedPointer<Private> d;
217};
218
219struct KRITAFLAKE_EXPORT KoPointerEventWrapper
220{
221 template <typename Event>
222 KoPointerEventWrapper(Event *_event, const QPointF &point);
223
226};
227
228#endif
229
const QScopedPointer< Private > d
QPointF point
The point in document coordinates.
QString button(const QWheelEvent &ev)
QString buttons(const T &ev)
QSharedPointer< QEvent > baseQtEvent