DtkDevice
DTK library for device.
dinputdevicegeneric.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DINPUTDEVICEGENERIC_H
6#define DINPUTDEVICEGENERIC_H
7
8#include "dtkdevice_global.h"
9
10#include <DExpected>
11#include <DObject>
12
13#include <QObject>
14#include <QSharedPointer>
15
17
18DDEVICE_BEGIN_NAMESPACE
19using DCORE_NAMESPACE::DExpected;
20using DCORE_NAMESPACE::DObject;
21class DInputDeviceGenericPrivate;
22class LIBDTKDEVICESHARED_EXPORT DInputDeviceGeneric : public QObject, public DObject
23{
24 Q_OBJECT
25 Q_PROPERTY(quint32 id READ id CONSTANT)
26 Q_PROPERTY(QString name READ name CONSTANT)
27 Q_PROPERTY(DeviceType type READ type CONSTANT)
28 Q_PROPERTY(bool enabled READ enabled NOTIFY enabledChanged)
29
30public:
31 virtual quint32 id() const;
32 virtual QString name() const;
33 virtual DeviceType type() const;
34 virtual bool enabled() const;
35
36 using Ptr = QSharedPointer<DInputDeviceGeneric>;
38
39Q_SIGNALS:
40 void enabledChanged(bool enabled);
41
42public Q_SLOTS:
43 virtual DExpected<void> reset();
44
45protected:
46 explicit DInputDeviceGeneric(const DeviceInfo &info = DeviceInfoInitializer, bool enabled = true, QObject *parent = nullptr);
47 DInputDeviceGeneric(DInputDeviceGenericPrivate &dd, const DeviceInfo &info, bool enabled, QObject *parent);
48 void setId(quint32 id);
49 void setName(const QString &name);
50 void setType(DeviceType type);
51 void setEnabled(bool enabled);
52 void setDeviceInfo(const DeviceInfo &info);
53
54private:
55 friend class DInputDeviceManager;
56 D_DECLARE_PRIVATE(DInputDeviceGeneric)
57};
58
59DDEVICE_END_NAMESPACE
60
61#endif
基本设备类
Definition: dinputdevicegeneric.h:23
void enabledChanged(bool enabled)
设备启用状态改变信号
void setDeviceInfo(const DeviceInfo &info)
设置设备信息
virtual bool enabled() const
获取设备是否启用
virtual DeviceType type() const
获取设备类型
void setId(quint32 id)
设置设备的id
virtual quint32 id() const
获取设备id
~DInputDeviceGeneric() override
析构函数
virtual DExpected< void > reset()
重置设备的设置
void setType(DeviceType type)
设置设备类型
void setEnabled(bool enabled)
设置设备是否启用
void setName(const QString &name)
设置设备名
virtual QString name() const
获取设备名
Manager类
Definition: dinputdevicemanager.h:27
DeviceType
设备类型
Definition: dtkinputdevices_types.h:13
设备信息类
Definition: dtkinputdevices_types.h:16