src/platform/qt/KeyEditor.h (view raw)
1/* Copyright (c) 2013-2014 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#ifndef QGBA_KEY_EDITOR
7#define QGBA_KEY_EDITOR
8
9#include <QLineEdit>
10
11namespace QGBA {
12
13class KeyEditor : public QLineEdit {
14Q_OBJECT
15
16public:
17 KeyEditor(QWidget* parent = nullptr);
18
19 void setValue(int key);
20 int value() const { return m_key; }
21
22 void setNumeric(bool numeric) { m_numeric = numeric; }
23
24 virtual QSize sizeHint() const override;
25
26signals:
27 void valueChanged(int key);
28
29protected:
30 virtual void keyPressEvent(QKeyEvent* event) override;
31
32private:
33 int m_key;
34 bool m_numeric;
35};
36
37}
38
39#endif