tcalc 0.2.0
 
Loading...
Searching...
No Matches
keyboard.hpp
Go to the documentation of this file.
1
12#pragma once
13
14#include <qlist.h>
15#include <qwidget.h>
16
17namespace tcalc_gui {
18
23class Keyboard : public QWidget
24{
25 Q_OBJECT
26
27public:
28 inline static const QList<QPair<QString, QPoint>> KEYMAP = {
29 { "B", { 0, 0 } }, { "F", { 1, 0 } }, { "log", { 2, 0 } },
30 { "exp", { 3, 0 } }, { "sqrt", { 4, 0 } }, { "pow", { 5, 0 } },
31 { "sin", { 0, 1 } }, { "cos", { 1, 1 } }, { "tan", { 2, 1 } },
32 { "asin", { 3, 1 } }, { "acos", { 4, 1 } }, { "atan", { 5, 1 } },
33 { "1", { 0, 2 } }, { "2", { 1, 2 } }, { "3", { 2, 2 } },
34 { "+", { 3, 2 } }, { "C", { 4, 2 } }, { "DEL", { 5, 2 } },
35 { "4", { 0, 3 } }, { "5", { 1, 3 } }, { "6", { 2, 3 } },
36 { "-", { 3, 3 } }, { "(", { 4, 3 } }, { ")", { 5, 3 } },
37 { "7", { 0, 4 } }, { "8", { 1, 4 } }, { "9", { 2, 4 } },
38 { "*", { 3, 4 } }, { "pi", { 4, 4 } }, { "e", { 5, 4 } },
39 { ".", { 0, 5 } }, { "0", { 1, 5 } }, { "=", { 2, 5 } },
40 { "/", { 3, 5 } }, { "ans", { 4, 5 } }
41 };
48 explicit Keyboard(QWidget* parent = nullptr);
49
50 ~Keyboard() override = default;
51
52signals:
58 void key_clicked(const QString& key);
59};
60
61}
Tcalc GUI keyboard.
Definition keyboard.hpp:24
static const QList< QPair< QString, QPoint > > KEYMAP
Definition keyboard.hpp:28
void key_clicked(const QString &key)
Emitted when a key is clicked.