DtkDeclarative
DTK Declarative module
载入中...
搜索中...
未找到
dquickkeylistener_p.h
1// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DQUICKKEYLISTENER_P_H
6#define DQUICKKEYLISTENER_P_H
7
8#include <dtkdeclarative_global.h>
9
10#include <DObject>
11#include <QObject>
12#include <QtQml/qqml.h>
13
14class QQuickItem;
15DQUICK_BEGIN_NAMESPACE
16
17class DQuickKeyListenerPrivate;
18class DQuickKeyListener : public QObject, DCORE_NAMESPACE::DObject
19{
20 Q_OBJECT
21 D_DECLARE_PRIVATE(DQuickKeyListener)
22 Q_PROPERTY(QQuickItem *target READ target WRITE setTarget NOTIFY targetChanged)
23 Q_PROPERTY(QStringList keys READ keys WRITE setKeys NOTIFY keysChanged)
24 Q_PROPERTY(int maxKeyCount READ maxKeyCount WRITE setMaxKeyCount NOTIFY maxKeyCountChanged)
25#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
26 QML_NAMED_ELEMENT(KeySequenceListener)
27#endif
28
29public:
30 explicit DQuickKeyListener(QObject *parent = nullptr);
31
32 QQuickItem *target() const;
33 void setTarget(QQuickItem *item);
34
35 const QStringList &keys() const;
36 void setKeys(const QStringList &keys);
37
38 int maxKeyCount() const;
39 void setMaxKeyCount(int count);
40
41 Q_INVOKABLE void clearKeys();
42
43Q_SIGNALS:
44 void targetChanged();
45 void keysChanged();
46 void maxKeyCountChanged();
47
48protected:
49 bool eventFilter(QObject *watched, QEvent *event) override;
50};
51
52DQUICK_END_NAMESPACE
53
54#endif // DQUICKKEYLISTENER_P_H
Definition dquickkeylistener_p.h:19