Pencil2D Animation
Download Community News Docs Contribute
  • Overview
  • Articles
  • Code
  •  
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • File List
Loading...
Searching...
No Matches
  • core_lib
  • src
  • util
pointerevent.h
1#ifndef POINTEREVENT_H
2#define POINTEREVENT_H
3
4#include <QTabletEvent>
5#include <QMouseEvent>
6
7class PointerEvent
8{
9public:
10 enum InputType {
11 Mouse,
12 Tablet,
13 Touch,
14 Unknown
15 };
16
17 enum Type {
18 Press,
19 Move,
20 Release,
21 Unmapped
22 };
23
24 PointerEvent(QMouseEvent* event, const QPointF& canvasPos);
25 PointerEvent(QTabletEvent* event, const QPointF& canvasPos);
26 ~PointerEvent();
27
31 QPointF canvasPos() const;
32
37 QPointF viewportPos() const;
38
43 qreal pressure() const;
44
47 qreal rotation() const;
48
56 qreal tangentialPressure() const;
57
59 int x() const;
60
62 int y() const;
63
65 bool isTabletEvent() const;
66
68 Qt::KeyboardModifiers modifiers() const;
69
71 Qt::MouseButton button() const;
72
74 Qt::MouseButtons buttons() const;
75
76 void accept();
77 void ignore();
78
79 bool isAccepted();
80
81 Type eventType() const;
82 InputType inputType() const;
83
84#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
85 QInputDevice::DeviceType device() const;
86 QPointingDevice::PointerType pointerType() const;
87#else
88 QTabletEvent::TabletDevice device() const;
89 QTabletEvent::PointerType pointerType() const;
90#endif
91
92private:
93 QTabletEvent* mTabletEvent = nullptr;
94 QMouseEvent* mMouseEvent = nullptr;
95 QPointF mCanvasPos;
96};
97
98#endif // POINTEREVENT_H
PointerEvent
Definition: pointerevent.h:8
PointerEvent::tangentialPressure
qreal tangentialPressure() const
Returns the tangential pressure of a tablet's that support it This is typically given by a finger whe...
Definition: pointerevent.cpp:88
PointerEvent::viewportPos
QPointF viewportPos() const
Returns the QPointF of the device, in viewport coordinates Returns pos() if used on mouse event.
Definition: pointerevent.cpp:24
PointerEvent::x
int x() const
Returns the x position of the input device in the widget.
Definition: pointerevent.cpp:97
PointerEvent::button
Qt::MouseButton button() const
Returns Qt::MouseButton()
Definition: pointerevent.cpp:38
PointerEvent::isTabletEvent
bool isTabletEvent() const
Returns true if the device was tablet, otherwise false.
Definition: pointerevent.cpp:132
PointerEvent::y
int y() const
Returns the y position of the input device in the widget.
Definition: pointerevent.cpp:115
PointerEvent::rotation
qreal rotation() const
Returns rotation value if any, otherwise 0.
Definition: pointerevent.cpp:79
PointerEvent::canvasPos
QPointF canvasPos() const
Returns the QPointF of the device, in canvas coordinates.
Definition: pointerevent.cpp:19
PointerEvent::modifiers
Qt::KeyboardModifiers modifiers() const
Returns the modifier created by keyboard while a device was in use.
Definition: pointerevent.cpp:144
PointerEvent::buttons
Qt::MouseButtons buttons() const
Returns Qt::MouseButtons()
Definition: pointerevent.cpp:54
PointerEvent::pressure
qreal pressure() const
Returns a value between 0 and 1 for tablet events, otherwise 1.0.
Definition: pointerevent.cpp:70
QMouseEvent
QPointF
Qt::KeyboardModifiers
typedef KeyboardModifiers
Qt::MouseButton
MouseButton
QTabletEvent
QTabletEvent::PointerType
PointerType
QTabletEvent::TabletDevice
TabletDevice
Generated on Thu May 8 2025 04:47:53 for Pencil2D by doxygen 1.9.6 based on revision 4513250b1d5b1a3676ec0e67b06b7a885ceaae39