DtkDevice
DTK library for device.
dinputdevicemouse.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DINPUTDEVICEMOUSE_H
6#define DINPUTDEVICEMOUSE_H
7
8#include "dtkdevice_global.h"
9
10#include <DExpected>
11#include <QObject>
12
13#include "dinputdevicepointer.h"
14
15DDEVICE_BEGIN_NAMESPACE
16
17using DCORE_NAMESPACE::DExpected;
18class DInputDeviceMousePrivate;
19class LIBDTKDEVICESHARED_EXPORT DInputDeviceMouse : public DInputDevicePointer
20{
21 Q_OBJECT
22 Q_PROPERTY(bool naturalScroll READ naturalScroll WRITE setNaturalScroll NOTIFY naturalScrollChanged)
23 Q_PROPERTY(
24 bool middleButtonEmulation READ middleButtonEmulation WRITE setMiddleButtonEmulation NOTIFY middleButtonEmulationChanged)
25
26public:
27 ~DInputDeviceMouse() override;
28 bool naturalScroll() const;
30
31 void setNaturalScroll(bool naturalScroll);
32 void setMiddleButtonEmulation(bool middleButtonEmulation);
33
34 bool leftHanded() const override;
35 ScrollMethod scrollMethod() const override;
37 double accelerationSpeed() const override;
38 void setLeftHanded(bool leftHanded) override;
39 void setScrollMethod(ScrollMethod method) override;
41 void setAccelerationSpeed(double speed) override;
42
43Q_SIGNALS:
44 void naturalScrollChanged(bool naturalScroll);
45 void middleButtonEmulationChanged(bool emulation);
46
47public Q_SLOTS:
48 DExpected<void> reset() override;
49
50protected:
51 explicit DInputDeviceMouse(const DeviceInfo &info = DeviceInfoInitializer, bool enabled = true, QObject *parent = nullptr);
52
53private:
54 friend class DInputDeviceManager;
55 D_DECLARE_PRIVATE(DInputDeviceMouse)
56};
57
58DDEVICE_END_NAMESPACE
59
60#endif // DINPUTDEVICEMOUSE_H
Manager类
Definition: dinputdevicemanager.h:27
鼠标设备类
Definition: dinputdevicemouse.h:20
bool naturalScroll() const
判断是否开启自然滚动模式
void setLeftHanded(bool leftHanded) override
设置是否是左手模式
void setNaturalScroll(bool naturalScroll)
设置开启或关闭自然滚动模式
AccelerationProfile accelerationProfile() const override
获取当前的指针加速方式
double accelerationSpeed() const override
获取指针加速度
bool leftHanded() const override
获取是否是左手模式
DInputDeviceMouse(const DeviceInfo &info=DeviceInfoInitializer, bool enabled=true, QObject *parent=nullptr)
空参构造函数和指定父对象的构造函数
void naturalScrollChanged(bool naturalScroll)
自然滚动模式改变信号
void middleButtonEmulationChanged(bool emulation)
中键模拟开关信号
void setMiddleButtonEmulation(bool middleButtonEmulation)
设置开启或关闭中键模拟
void setScrollMethod(ScrollMethod method) override
设置滚动模式
bool middleButtonEmulation() const
判断是否开启中键模拟
void setAccelerationSpeed(double speed) override
设置指针加速度
DExpected< void > reset() override
重置所有设置
ScrollMethod scrollMethod() const override
获取当前滚动模式
void setAccelerationProfile(AccelerationProfile profile) override
设置指针加速方式
抽象指针设备类
Definition: dinputdevicepointer.h:20
ScrollMethod
滚动方式
Definition: dtkinputdevices_types.h:33
AccelerationProfile
指针加速方式
Definition: dtkinputdevices_types.h:27
设备信息类
Definition: dtkinputdevices_types.h:16