Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 09:10:01

0001 // Copyright (C) 2020 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QINPUTDEVICE_H
0005 #define QINPUTDEVICE_H
0006 
0007 #include <QtGui/qtguiglobal.h>
0008 #include <QtCore/qobject.h>
0009 #include <QtGui/qscreen.h>
0010 
0011 QT_BEGIN_NAMESPACE
0012 
0013 class QDebug;
0014 class QInputDevicePrivate;
0015 
0016 class Q_GUI_EXPORT QInputDevice : public QObject
0017 {
0018     Q_OBJECT
0019     Q_DECLARE_PRIVATE(QInputDevice)
0020     Q_PROPERTY(QString name READ name CONSTANT)
0021     Q_PROPERTY(DeviceType type READ type CONSTANT)
0022     Q_PROPERTY(Capabilities capabilities READ capabilities
0023                NOTIFY capabilitiesChanged)
0024     Q_PROPERTY(qint64 systemId READ systemId CONSTANT)
0025     Q_PROPERTY(QString seatName READ seatName CONSTANT)
0026     Q_PROPERTY(QRect availableVirtualGeometry READ availableVirtualGeometry
0027                NOTIFY availableVirtualGeometryChanged)
0028 
0029 public:
0030     enum class DeviceType {
0031         Unknown = 0x0000,
0032         Mouse = 0x0001,
0033         TouchScreen = 0x0002,
0034         TouchPad = 0x0004,
0035         Puck = 0x0008,
0036         Stylus = 0x0010,
0037         Airbrush = 0x0020,
0038         Keyboard = 0x1000,
0039         AllDevices = 0x7FFFFFFF
0040     };
0041     Q_DECLARE_FLAGS(DeviceTypes, DeviceType)
0042     Q_FLAG(DeviceTypes)
0043 
0044     enum class Capability {
0045         None = 0,
0046         Position = 0x0001,
0047         Area = 0x0002,
0048         Pressure = 0x0004,
0049         Velocity = 0x0008,
0050         NormalizedPosition = 0x0020,
0051         MouseEmulation = 0x0040,
0052         PixelScroll = 0x0080,
0053         Scroll      = 0x0100,
0054         Hover       = 0x0200,
0055         Rotation    = 0x0400,
0056         XTilt       = 0x0800,
0057         YTilt       = 0x1000,
0058         TangentialPressure = 0x2000,
0059         ZPosition   = 0x4000,
0060         All = 0x7FFFFFFF
0061     };
0062     Q_DECLARE_FLAGS(Capabilities, Capability)
0063     Q_FLAG(Capabilities)
0064 
0065     QInputDevice(QObject *parent = nullptr);
0066     ~QInputDevice();
0067     QInputDevice(const QString &name, qint64 systemId, DeviceType type,
0068                  const QString &seatName = QString(), QObject *parent = nullptr);
0069 
0070     QString name() const;
0071     DeviceType type() const;
0072     Capabilities capabilities() const;
0073     bool hasCapability(Capability cap) const;
0074     qint64 systemId() const;
0075     QString seatName() const;
0076     QRect availableVirtualGeometry() const;
0077 
0078     static QStringList seatNames();
0079     static QList<const QInputDevice *> devices();
0080     static const QInputDevice *primaryKeyboard(const QString& seatName = QString());
0081 
0082     bool operator==(const QInputDevice &other) const;
0083 
0084 Q_SIGNALS:
0085     void availableVirtualGeometryChanged(QRect area);
0086     Q_REVISION(6, 9) void capabilitiesChanged(Capabilities capabilities);
0087 
0088 protected:
0089     QInputDevice(QInputDevicePrivate &d, QObject *parent);
0090 
0091     Q_DISABLE_COPY_MOVE(QInputDevice)
0092 };
0093 
0094 Q_DECLARE_OPERATORS_FOR_FLAGS(QInputDevice::DeviceTypes)
0095 Q_DECLARE_OPERATORS_FOR_FLAGS(QInputDevice::Capabilities)
0096 
0097 #ifndef QT_NO_DEBUG_STREAM
0098 Q_GUI_EXPORT QDebug operator<<(QDebug, const QInputDevice *);
0099 #endif
0100 
0101 QT_END_NAMESPACE
0102 
0103 #endif // QINPUTDEVICE_H