File indexing completed on 2025-01-18 10:08:15
0001
0002
0003
0004 #ifndef QPOINTINGDEVICE_H
0005 #define QPOINTINGDEVICE_H
0006
0007 #include <QtGui/qtguiglobal.h>
0008 #include <QtCore/qobject.h>
0009 #include <QtGui/qinputdevice.h>
0010
0011 QT_BEGIN_NAMESPACE
0012
0013 class QDebug;
0014 class QEventPoint;
0015 class QPointerEvent;
0016 class QPointingDevicePrivate;
0017 class QPointerEvent;
0018 class QScreen;
0019
0020 class Q_GUI_EXPORT QPointingDeviceUniqueId
0021 {
0022 Q_GADGET
0023 Q_PROPERTY(qint64 numericId READ numericId CONSTANT)
0024 public:
0025 Q_ALWAYS_INLINE
0026 constexpr QPointingDeviceUniqueId() noexcept : m_numericId(-1) {}
0027
0028
0029
0030 static QPointingDeviceUniqueId fromNumericId(qint64 id);
0031
0032 Q_ALWAYS_INLINE constexpr bool isValid() const noexcept { return m_numericId != -1; }
0033 qint64 numericId() const noexcept;
0034
0035 private:
0036 friend bool operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept
0037 { return lhs.numericId() == rhs.numericId(); }
0038 friend bool operator!=(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept
0039 { return lhs.numericId() != rhs.numericId(); }
0040
0041
0042
0043
0044 qint64 m_numericId;
0045 };
0046 Q_DECLARE_TYPEINFO(QPointingDeviceUniqueId, Q_RELOCATABLE_TYPE);
0047
0048 Q_GUI_EXPORT size_t qHash(QPointingDeviceUniqueId key, size_t seed = 0) noexcept;
0049
0050 class Q_GUI_EXPORT QPointingDevice : public QInputDevice
0051 {
0052 Q_OBJECT
0053 Q_DECLARE_PRIVATE(QPointingDevice)
0054 Q_PROPERTY(PointerType pointerType READ pointerType CONSTANT)
0055 Q_PROPERTY(int maximumPoints READ maximumPoints CONSTANT)
0056 Q_PROPERTY(int buttonCount READ buttonCount CONSTANT)
0057 Q_PROPERTY(QPointingDeviceUniqueId uniqueId READ uniqueId CONSTANT)
0058
0059 public:
0060 enum class PointerType {
0061 Unknown = 0,
0062 Generic = 0x0001,
0063 Finger = 0x0002,
0064 Pen = 0x0004,
0065 Eraser = 0x0008,
0066 Cursor = 0x0010,
0067 AllPointerTypes = 0x7FFF
0068 };
0069 Q_DECLARE_FLAGS(PointerTypes, PointerType)
0070 Q_FLAG(PointerTypes)
0071
0072 enum GrabTransition {
0073 GrabPassive = 0x01,
0074 UngrabPassive = 0x02,
0075 CancelGrabPassive = 0x03,
0076 OverrideGrabPassive = 0x04,
0077 GrabExclusive = 0x10,
0078 UngrabExclusive = 0x20,
0079 CancelGrabExclusive = 0x30,
0080 };
0081 Q_ENUM(GrabTransition)
0082
0083 QPointingDevice(QObject *parent = nullptr);
0084 ~QPointingDevice();
0085 QPointingDevice(const QString &name, qint64 systemId, QInputDevice::DeviceType devType,
0086 PointerType pType, Capabilities caps, int maxPoints, int buttonCount,
0087 const QString &seatName = QString(),
0088 QPointingDeviceUniqueId uniqueId = QPointingDeviceUniqueId(),
0089 QObject *parent = nullptr);
0090
0091 #if QT_DEPRECATED_SINCE(6, 0)
0092 QT_DEPRECATED_VERSION_X_6_0("Use the constructor")
0093 void setType(DeviceType devType);
0094 QT_DEPRECATED_VERSION_X_6_0("Use the constructor")
0095 void setCapabilities(QInputDevice::Capabilities caps);
0096 QT_DEPRECATED_VERSION_X_6_0("Use the constructor")
0097 void setMaximumTouchPoints(int c);
0098 #endif
0099
0100 PointerType pointerType() const;
0101 int maximumPoints() const;
0102 int buttonCount() const;
0103 QPointingDeviceUniqueId uniqueId() const;
0104
0105 static const QPointingDevice *primaryPointingDevice(const QString& seatName = QString());
0106
0107 bool operator==(const QPointingDevice &other) const;
0108
0109 Q_SIGNALS:
0110 #if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
0111 void grabChanged(QObject *grabber, GrabTransition transition,
0112 const QPointerEvent *event, const QEventPoint &point) const;
0113 #else
0114 void grabChanged(QObject *grabber, QPointingDevice::GrabTransition transition,
0115 const QPointerEvent *event, const QEventPoint &point);
0116 #endif
0117
0118 protected:
0119 QPointingDevice(QPointingDevicePrivate &d, QObject *parent);
0120
0121 Q_DISABLE_COPY_MOVE(QPointingDevice)
0122 };
0123
0124 Q_DECLARE_OPERATORS_FOR_FLAGS(QPointingDevice::PointerTypes)
0125
0126 #ifndef QT_NO_DEBUG_STREAM
0127 Q_GUI_EXPORT QDebug operator<<(QDebug, const QPointingDevice *);
0128 #endif
0129
0130
0131
0132 QT_END_NAMESPACE
0133
0134 #endif