DtkDevice
DTK library for device.
dtkinputdevices_types.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DTKINPUTDEVICES_TYPES_H
6#define DTKINPUTDEVICES_TYPES_H
7#include "dtkdevice_global.h"
8#include <QObject>
9#include <QString>
10
11DDEVICE_BEGIN_NAMESPACE
12
13enum class DeviceType { Mouse, TrackPoint, TouchPad, Tablet, Keyboard, Generic };
14
16{
17 quint32 id;
18 QString name;
20
21 friend bool operator==(const DeviceInfo &lhs, const DeviceInfo &rhs);
22 friend QDebug operator<<(QDebug debug, const DeviceInfo &info);
23};
24
25extern const DeviceInfo DeviceInfoInitializer;
26
27enum class AccelerationProfile { Flat, Adaptive, Na };
28
29enum class Key { KeyUp, KeyDown };
30
31enum class KeyAction { LeftClick, MiddleClick, RightClick, PageUp, PageDown };
32
33enum class ScrollMethod { NoScroll, ScrollTwoFinger, ScrollEdge, ScrollOnButtonDown };
34
35class LIBDTKDEVICESHARED_EXPORT EnumWrapper : public QObject
36{
37 Q_OBJECT
38public:
39 enum ErrorCode { InvalidCall };
40 Q_ENUM(ErrorCode)
41};
42
43QDebug operator<<(QDebug debug, DeviceType type);
44QDebug operator<<(QDebug debug, AccelerationProfile profile);
45
46using ErrorCode = EnumWrapper::ErrorCode;
47
48DDEVICE_END_NAMESPACE
49Q_DECLARE_METATYPE(DTK_DEVICE_NAMESPACE::DeviceType)
50Q_DECLARE_METATYPE(DTK_DEVICE_NAMESPACE::DeviceInfo)
51Q_DECLARE_METATYPE(DTK_DEVICE_NAMESPACE::AccelerationProfile)
52Q_DECLARE_METATYPE(DTK_DEVICE_NAMESPACE::Key)
53Q_DECLARE_METATYPE(DTK_DEVICE_NAMESPACE::KeyAction)
54Q_DECLARE_METATYPE(DTK_DEVICE_NAMESPACE::ScrollMethod)
55Q_DECLARE_METATYPE(DTK_DEVICE_NAMESPACE::ErrorCode)
56#endif // DTKINPUTDEVICES_TYPES_H
枚举类型包装器
Definition: dtkinputdevices_types.h:36
ErrorCode
错误代码
Definition: dtkinputdevices_types.h:39
Key
按键动作
Definition: dtkinputdevices_types.h:29
DeviceType
设备类型
Definition: dtkinputdevices_types.h:13
ScrollMethod
滚动方式
Definition: dtkinputdevices_types.h:33
AccelerationProfile
指针加速方式
Definition: dtkinputdevices_types.h:27
KeyAction
按键动作映射
Definition: dtkinputdevices_types.h:31
设备信息类
Definition: dtkinputdevices_types.h:16
quint32 id
Definition: dtkinputdevices_types.h:17
QString name
Definition: dtkinputdevices_types.h:18
DeviceType type
Definition: dtkinputdevices_types.h:19