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
qpointingdevice_p.h
Go to the documentation of this file.
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 QPOINTINGDEVICE_P_H
5#define QPOINTINGDEVICE_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 purely as an
12// implementation detail. 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 <QtCore/qloggingcategory.h>
19#include <QtGui/private/qevent_p.h>
20#include <QtGui/qpointingdevice.h>
21#include <QtGui/private/qtguiglobal_p.h>
22#include <QtGui/private/qinputdevice_p.h>
23
24#include <QtCore/qpointer.h>
25#include <QtCore/private/qflatmap_p.h>
26
28
30
32{
33 Q_DECLARE_PUBLIC(QPointingDevice)
34public:
36 QPointingDevice::PointerType pType, QPointingDevice::Capabilities caps,
37 int maxPoints, int buttonCount,
38 const QString &seatName = QString(),
40 : QInputDevicePrivate(name, id, type, caps, seatName),
41 uniqueId(uniqueId),
42 maximumTouchPoints(qint8(maxPoints)), buttonCount(qint8(buttonCount)),
43 pointerType(pType)
44 {
45 pointingDeviceType = true;
46 activePoints.reserve(maxPoints);
47 }
49
50 void sendTouchCancelEvent(QTouchEvent *cancelEvent);
51
57 QPointer<QObject> exclusiveGrabber;
58 QPointer<QObject> exclusiveGrabberContext; // extra info about where the grab happened
59 QList<QPointer <QObject> > passiveGrabbers;
60 QList<QPointer <QObject> > passiveGrabbersContext; // parallel list: extra info about where the grabs happened
61 };
62 EventPointData *queryPointById(int id) const;
63 EventPointData *pointById(int id) const;
64 void removePointById(int id);
65 QObject *firstActiveTarget() const;
66 QWindow *firstActiveWindow() const;
67
68 QObject *firstPointExclusiveGrabber() const;
69 void setExclusiveGrabber(const QPointerEvent *event, const QEventPoint &point, QObject *exclusiveGrabber);
70 bool removeExclusiveGrabber(const QPointerEvent *event, const QObject *grabber);
71 bool addPassiveGrabber(const QPointerEvent *event, const QEventPoint &point, QObject *grabber);
72 static bool setPassiveGrabberContext(EventPointData *epd, QObject *grabber, QObject *context);
73 bool removePassiveGrabber(const QPointerEvent *event, const QEventPoint &point, QObject *grabber);
74 void clearPassiveGrabbers(const QPointerEvent *event, const QEventPoint &point);
75 void removeGrabber(QObject *grabber, bool cancel = false);
76
77 using EventPointMap = QVarLengthFlatMap<int, EventPointData, 20>;
79
81 quint32 toolId = 0; // only for Wacom tablets
82 qint8 maximumTouchPoints = 0;
83 qint8 buttonCount = 0;
85 bool toolProximity = false; // only for Wacom tablets
86
88 {
89 return static_cast<QPointingDevicePrivate *>(QObjectPrivate::get(q));
90 }
91
92 inline static const QPointingDevicePrivate *get(const QPointingDevice *q)
93 {
94 return static_cast<const QPointingDevicePrivate *>(QObjectPrivate::get(q));
95 }
96
97 static const QPointingDevice *tabletDevice(QInputDevice::DeviceType deviceType,
100
101 static const QPointingDevice *queryTabletDevice(QInputDevice::DeviceType deviceType,
104 QInputDevice::Capabilities capabilities = QInputDevice::Capability::None,
105 qint64 systemId = 0);
106
107 static const QPointingDevice *pointingDeviceById(qint64 systemId);
108};
109
111
112#endif // QPOINTINGDEVICE_P_H
The QEventPoint class provides information about a point in a QPointerEvent.
Definition qeventpoint.h:20
DeviceType
This enum represents the type of device that generated a QPointerEvent.
static QObjectPrivate * get(QObject *o)
Definition qobject_p.h:150
\inmodule QtCore
Definition qobject.h:103
A base class for pointer events.
Definition qevent.h:73
~QPointingDevicePrivate() override
QPointingDevicePrivate(const QString &name, qint64 id, QInputDevice::DeviceType type, QPointingDevice::PointerType pType, QPointingDevice::Capabilities caps, int maxPoints, int buttonCount, const QString &seatName=QString(), QPointingDeviceUniqueId uniqueId=QPointingDeviceUniqueId())
static const QPointingDevicePrivate * get(const QPointingDevice *q)
QVarLengthFlatMap< int, EventPointData, 20 > EventPointMap
QPointingDeviceUniqueId uniqueId
static QPointingDevicePrivate * get(QPointingDevice *q)
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.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QTouchEvent class contains parameters that describe a touch event.
Definition qevent.h:917
\inmodule QtGui
Definition qwindow.h:63
Combined button and popup list for selecting options.
static void * context
#define Q_DECLARE_LOGGING_CATEGORY(name)
GLenum GLuint id
[7]
GLenum type
GLuint name
struct _cl_event * event
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
unsigned int quint32
Definition qtypes.h:50
long long qint64
Definition qtypes.h:60
QT_BEGIN_NAMESPACE typedef signed char qint8
Definition qtypes.h:45
static QPointingDevice::PointerType pointerType(unsigned currentCursor)
static QInputDevice::DeviceType deviceType(const UINT cursorType)
future cancel()
QList< QPointer< QObject > > passiveGrabbers
QList< QPointer< QObject > > passiveGrabbersContext