1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#ifndef HOTKEYLINEEDIT_H
6#define HOTKEYLINEEDIT_H
7
8#include <QLineEdit>
9#include <QKeyEvent>
10#include <QFocusEvent>
11
12class HotkeyLineEditPrivate;
13class HotkeyLineEdit : public QLineEdit
14{
15 Q_OBJECT
16public:
17 explicit HotkeyLineEdit(QWidget *parent = nullptr);
18 virtual ~HotkeyLineEdit() override;
19 void setKey(int key);
20 int getKey();
21 void setText(QString text);
22 void setHotkeyMode(bool hotkeyMode);
23 bool isHotkeyMode();
24
25signals:
26 void sigKeyChanged(int key);
27
28protected:
29 void keyPressEvent(QKeyEvent *e) override;
30 HotkeyLineEditPrivate *const d;
31};
32
33#endif // HOTKEYLINEEDIT_H
34