File indexing completed on 2024-11-24 03:56:28

0001 /*
0002  * SPDX-FileCopyrightText: 2019-2023 Mattia Basaglia <dev@dragon.best>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 
0007 #ifndef CLEARABLEKEYSEQUENCEEDIT_H
0008 #define CLEARABLEKEYSEQUENCEEDIT_H
0009 
0010 #include <memory>
0011 #include <QWidget>
0012 #include <QKeySequence>
0013 
0014 class ClearableKeysequenceEdit : public QWidget
0015 {
0016     Q_OBJECT
0017 
0018 public:
0019     ClearableKeysequenceEdit(QWidget* parent = nullptr);
0020     ~ClearableKeysequenceEdit();
0021 
0022     void set_key_sequence(const QKeySequence& ks);
0023     void set_default_key_sequence(const QKeySequence& ks);
0024 
0025     QKeySequence key_sequence() const;
0026 
0027 protected:
0028     void changeEvent ( QEvent* e ) override;
0029 
0030 private Q_SLOTS:
0031     void use_default();
0032     void use_nothing();
0033 
0034 private:
0035     class Private;
0036     std::unique_ptr<Private> d;
0037 };
0038 
0039 #endif // CLEARABLEKEYSEQUENCEEDIT_H