-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculator.h
83 lines (63 loc) · 1.76 KB
/
calculator.h
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef CALCULATOR_H
#define CALCULATOR_H
#include <QWidget>
#include <QtWidgets/QToolButton>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QFrame>
#include <iostream>
class QLineEdit;
class Button;
class radioButton;
class Calculator : public QWidget
{
Q_OBJECT
public:
Calculator(QWidget *parent = 0);
int CNUM_TYPE = 16;
private:
Button *createButton(const QString &text, const char *member);
radioButton *createRadioButton(const QString &text, const char *member);
QLineEdit *createDisplay(int widht = 150);
void abortOperation();
bool calculate(unsigned __int32 rightOperand, const QString &pendingOperator);
unsigned __int32 sumInMemory;
unsigned __int32 sumSoFar;
unsigned __int32 factorSoFar;
QString pendingAdditiveOperator;
QString pendingMultiplicativeOperator;
bool waitingForOperand;
QLineEdit *display;
QLineEdit *hexDisplay;
QLineEdit *decDisplay;
QLineEdit *octDisplay;
QLineEdit *binDisplay;
QLineEdit *valueShift;
enum { NumDigitButtons = 16 };
Button *digitButtons[NumDigitButtons];
enum { NumBitButtons = 32 };
Button *bitButtons[NumBitButtons];
Button *bitLabel[NumBitButtons];
private slots:
void digitClicked();
void bitClicked();
void unaryOperatorClicked();
void additiveOperatorClicked();
void multiplicativeOperatorClicked();
void equalClicked();
void pointClicked();
void changeSignClicked();
void backspaceClicked();
void clear();
void clearAll();
void clearMemory();
void readMemory();
void setMemory();
void addToMemory();
void bitButtonsChange();
void numeralClicked();
void rShiftClicked();
void lShiftClicked();
void displayNumeral();
void about();
};
#endif