aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner/components/eventlist/shortcutwidget.h
blob: 288040d56b7405e8b73dfd7887f87d7ad6b8557d (plain)
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
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once

#include <array>
#include <QWidget>

QT_FORWARD_DECLARE_CLASS(QLineEdit)
QT_FORWARD_DECLARE_CLASS(QPushButton)

namespace QmlDesigner {

class ShortcutWidget : public QWidget
{
    Q_OBJECT

signals:
    void done();
    void cancel();

public:
    ShortcutWidget(QWidget *parent = nullptr);
    bool containsFocus() const;
    QString text() const;

    void reset();
    void recordKeysequence(QKeyEvent *event);

protected:
    void resizeEvent(QResizeEvent *event) override;

private:
    QLineEdit *m_text;
    QPushButton *m_button;
    std::array<int, 4> m_key;
    int m_keyNum = 0;
};

} // namespace QmlDesigner.