Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwindowstabletsupport.h
Go to the documentation of this file.
1// Copyright (C) 2016 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 QWINDOWSTABLETSUPPORT_H
5#define QWINDOWSTABLETSUPPORT_H
6
7#include "qtwindowsglobal.h"
8#include <QtGui/qtguiglobal.h>
9#include <QtGui/qpointingdevice.h>
10
11#include <QtCore/qhash.h>
12#include <QtCore/qlist.h>
13#include <QtCore/qpoint.h>
14#include <QtCore/qsharedpointer.h>
15
16#include <wintab.h>
17
18QT_REQUIRE_CONFIG(tabletevent);
19
21
22class QDebug;
23class QWindow;
24class QRect;
25
27{
28 bool init();
29
30 typedef HCTX (API *PtrWTOpen)(HWND, LPLOGCONTEXT, BOOL);
31 typedef BOOL (API *PtrWTClose)(HCTX);
32 typedef UINT (API *PtrWTInfo)(UINT, UINT, LPVOID);
33 typedef BOOL (API *PtrWTEnable)(HCTX, BOOL);
34 typedef BOOL (API *PtrWTOverlap)(HCTX, BOOL);
35 typedef int (API *PtrWTPacketsGet)(HCTX, int, LPVOID);
36 typedef BOOL (API *PtrWTGet)(HCTX, LPLOGCONTEXT);
37 typedef int (API *PtrWTQueueSizeGet)(HCTX);
38 typedef BOOL (API *PtrWTQueueSizeSet)(HCTX, int);
39
40 PtrWTOpen wTOpen = nullptr;
42 PtrWTInfo wTInfo = nullptr;
46 PtrWTGet wTGet = nullptr;
49};
50
51// Data associated with a physical cursor (system ID) which is shared between
52// devices of varying device type/pointer type.
54{
55 QPointF scaleCoordinates(int coordX, int coordY,const QRect &targetArea) const;
58
59 int minPressure = 0;
60 int maxPressure = 0;
63 int minX = 0;
64 int maxX = 0;
65 int minY = 0;
66 int maxY = 0;
67 int minZ = 0;
68 int maxZ = 0;
70 bool zCapability = false;
71 bool tiltCapability = false;
72 QHash<quint8, quint8> buttonsMap;
73};
74
76{
77public:
78 using DeviceDataPtr = QSharedPointer<QWindowsTabletDeviceData>;
79
83 PointerType pType, Capabilities caps, int maxPoints,
84 int buttonCount, const QString &seatName = QString(),
86 QObject *parent = nullptr);
87
88 const DeviceDataPtr &deviceData() const { return m_deviceData; }
89
90private:
91 DeviceDataPtr m_deviceData;
92};
93
94#ifndef QT_NO_DEBUG_STREAM
96#endif
97
99{
100 Q_DISABLE_COPY_MOVE(QWindowsTabletSupport)
101
102 explicit QWindowsTabletSupport(HWND window, HCTX context);
103
104public:
105 using DevicePtr = QSharedPointer<QWinTabPointingDevice>;
106 using Devices = QList<DevicePtr>;
107
108 enum Mode
109 {
112 };
113
120
122
124
125 void notifyActivate();
126 QString description() const;
127
128 bool translateTabletProximityEvent(WPARAM wParam, LPARAM lParam);
130
131 static int absoluteRange() { return m_absoluteRange; }
132 static void setAbsoluteRange(int a) { m_absoluteRange = a; }
133
134private:
135 unsigned options() const;
136 QWindowsTabletDeviceData tabletInit(qint64 uniqueId, UINT cursorType) const;
137 void updateData(QWindowsTabletDeviceData *data) const;
138 void updateButtons(unsigned currentCursor, QWindowsTabletDeviceData *data) const;
139 void enterProximity(ulong time = 0, QWindow *window = nullptr);
140 void leaveProximity(ulong time = 0, QWindow *window = nullptr);
141 void enterLeaveProximity(bool enter, ulong time, QWindow *window = nullptr);
142 DevicePtr findDevice(qint64 systemId) const;
143 DevicePtr findDevice(qint64 systemId,
146 DevicePtr clonePhysicalDevice(qint64 systemId,
149
150 static QWindowsWinTab32DLL m_winTab32DLL;
151 const HWND m_window;
152 const HCTX m_context;
153 static int m_absoluteRange;
154 bool m_tiltSupport = false;
155 Devices m_devices;
156 DevicePtr m_currentDevice;
157 Mode m_mode = PenMode;
158 State m_state = PenUp;
159 ulong m_eventTime = 0;
160};
161
163
164#endif // QWINDOWSTABLETSUPPORT_H
\inmodule QtCore
DeviceType
This enum represents the type of device that generated a QPointerEvent.
QString seatName
qint64 systemId
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
\inmodule QtCore\reentrant
Definition qpoint.h:217
QPointingDeviceUniqueId identifies a unique object, such as a tagged token or stylus,...
The QPointingDevice class describes a device from which mouse, touch or tablet events originate.
PointerType
This enum represents what is interacting with the pointing device.
QPointingDeviceUniqueId uniqueId
\inmodule QtCore\reentrant
Definition qrect.h:30
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
QWinTabPointingDevice(const DeviceDataPtr &data, const QString &name, qint64 systemId, QInputDevice::DeviceType devType, PointerType pType, Capabilities caps, int maxPoints, int buttonCount, const QString &seatName=QString(), QPointingDeviceUniqueId uniqueId=QPointingDeviceUniqueId(), QObject *parent=nullptr)
QSharedPointer< QWindowsTabletDeviceData > DeviceDataPtr
const DeviceDataPtr & deviceData() const
\inmodule QtGui
Definition qwindow.h:63
Tablet support for Windows.
static void setAbsoluteRange(int a)
bool translateTabletProximityEvent(WPARAM wParam, LPARAM lParam)
QSharedPointer< QWinTabPointingDevice > DevicePtr
static QWindowsTabletSupport * create()
Combined button and popup list for selecting options.
static void * context
GLfloat GLfloat GLfloat GLfloat GLfloat maxY
GLboolean GLboolean GLboolean GLboolean a
[7]
GLfloat minY
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat maxZ
GLuint name
GLfloat GLfloat minZ
GLfloat GLfloat GLfloat GLfloat maxX
GLdouble GLdouble t
Definition qopenglext.h:243
GLfloat GLfloat p
[1]
#define QT_REQUIRE_CONFIG(feature)
unsigned long ulong
Definition qtypes.h:35
long long qint64
Definition qtypes.h:60
double qreal
Definition qtypes.h:187
static QPointingDevice::PointerType pointerType(unsigned currentCursor)
static QInputDevice::DeviceType deviceType(const UINT cursorType)
QDebug operator<<(QDebug d, const QWindowsTabletDeviceData &t)
aWidget window() -> setWindowTitle("New Window Title")
[2]
QPointF scaleCoordinates(int coordX, int coordY, const QRect &targetArea) const
qreal scalePressure(qreal p) const
qreal scaleTangentialPressure(qreal p) const
QHash< quint8, quint8 > buttonsMap
Functions from wintabl32.dll shipped with WACOM tablets used by QWindowsTabletSupport.
PtrWTQueueSizeSet wTQueueSizeSet
int(API * PtrWTQueueSizeGet)(HCTX)
BOOL(API * PtrWTGet)(HCTX, LPLOGCONTEXT)
UINT(API * PtrWTInfo)(UINT, UINT, LPVOID)
BOOL(API * PtrWTEnable)(HCTX, BOOL)
BOOL(API * PtrWTOverlap)(HCTX, BOOL)
BOOL(API * PtrWTClose)(HCTX)
BOOL(API * PtrWTQueueSizeSet)(HCTX, int)
int(API * PtrWTPacketsGet)(HCTX, int, LPVOID)
PtrWTQueueSizeGet wTQueueSizeGet
HCTX(API * PtrWTOpen)(HWND, LPLOGCONTEXT, BOOL)