forked from linuxdeepin/qt5platform-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdapplicationeventmonitor.h
48 lines (34 loc) · 1005 Bytes
/
dapplicationeventmonitor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// SPDX-FileCopyrightText: 2020 - 2022 Uniontech Software Technology Co.,Ltd.
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#ifndef DAPPLICATIONEVENTMONITOR_H
#define DAPPLICATIONEVENTMONITOR_H
#include "global.h"
#include <QObject>
#include <QEvent>
DPP_BEGIN_NAMESPACE
class DApplicationEventMonitor : public QObject
{
Q_OBJECT
public:
enum InputDeviceType {
None = 0, // 初始状态
Mouse = 1, //鼠标
Tablet = 2, //平板外围设备
Keyboard = 3, //键盘
TouchScreen = 4 //触摸屏
};
DApplicationEventMonitor(QObject *parent = nullptr);
~DApplicationEventMonitor() override;
InputDeviceType lastInputDeviceType() const;
protected:
bool eventFilter(QObject *watched, QEvent *event) override;
private:
static InputDeviceType eventType(QEvent *type);
signals:
void lastInputDeviceTypeChanged();
private:
InputDeviceType m_lastInputDeviceType;
};
DPP_END_NAMESPACE
#endif // DAPPLICATIONEVENTMONITOR_H