DtkWidget
DTK Widget module
载入中...
搜索中...
未找到
dregionmonitor.h
1// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DREGIONMONITOR_H_DWIDGET
6#define DREGIONMONITOR_H_DWIDGET
7
8#include <DObject>
9#include <dtkwidget_global.h>
10
11#include <QObject>
12
13#if DTK_VERSION < DTK_VERSION_CHECK(6, 0, 0, 0)
14
15DWIDGET_BEGIN_NAMESPACE
16
17class DRegionMonitorPrivate;
18class D_DECL_DEPRECATED_X("Use libdtkgui") DRegionMonitor : public QObject
19 , public DTK_CORE_NAMESPACE::DObject
20{
21 Q_OBJECT
22 D_DECLARE_PRIVATE(DRegionMonitor)
23 Q_DISABLE_COPY(DRegionMonitor)
24 Q_PROPERTY(CoordinateType coordinateType READ coordinateType WRITE setCoordinateType NOTIFY coordinateTypeChanged)
25
26public:
27 explicit DRegionMonitor(QObject *parent = nullptr);
28
29 enum WatchedFlags {
30 Button_Left = 1,
31 Button_Right = 3,
32 };
33
34 enum CoordinateType {
35 ScaleRatio,
36 Original
37 };
38 Q_ENUM(CoordinateType)
39
40 bool registered() const;
41 QRegion watchedRegion() const;
42 CoordinateType coordinateType() const;
43
44Q_SIGNALS:
45 void buttonPress(const QPoint &p, const int flag) const;
46 void buttonRelease(const QPoint &p, const int flag) const;
47 void cursorMove(const QPoint &p) const;
48 void keyPress(const QString &keyname) const;
49 void keyRelease(const QString &keyname) const;
50 void coordinateTypeChanged(CoordinateType type) const;
51
52public Q_SLOTS:
53 void registerRegion();
54 inline void registerRegion(const QRegion &region)
55 {
56 setWatchedRegion(region);
57 registerRegion();
58 }
59 void unregisterRegion();
60 void setWatchedRegion(const QRegion &region);
61 void setCoordinateType(CoordinateType type);
62};
63
64DWIDGET_END_NAMESPACE
65
66#endif // DREGIONMONITOR_H_DWIDGET
67
68#endif