52 lines
897 B
C
52 lines
897 B
C
|
#ifndef MAINWINDOW_H
|
||
|
#define MAINWINDOW_H
|
||
|
|
||
|
#include <QMainWindow>
|
||
|
|
||
|
QT_BEGIN_NAMESPACE
|
||
|
namespace Ui { class MainWindow; }
|
||
|
QT_END_NAMESPACE
|
||
|
|
||
|
class MainWindow : public QMainWindow
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
MainWindow(QWidget *parent = nullptr);
|
||
|
~MainWindow();
|
||
|
|
||
|
private:
|
||
|
Ui::MainWindow *ui;
|
||
|
|
||
|
//终止运算,清除数据,报错
|
||
|
void abortOperation();
|
||
|
//连接信号和槽
|
||
|
void connectSlots();
|
||
|
//储存运算符
|
||
|
QString pendingOperator;
|
||
|
//储存运算结果
|
||
|
double result;
|
||
|
//标记是否等待一个操作数
|
||
|
bool waitForOperand;
|
||
|
|
||
|
bool isFinished;
|
||
|
|
||
|
private slots:
|
||
|
void on_clearBtn_clicked();
|
||
|
|
||
|
void on_clearAllBtn_clicked();
|
||
|
|
||
|
void on_equalBtn_clicked();
|
||
|
|
||
|
void digitClicked();
|
||
|
|
||
|
void on_signBtn_clicked();
|
||
|
|
||
|
void operatorClicked();
|
||
|
|
||
|
void on_pointBtn_clicked();
|
||
|
|
||
|
void on_squareBtn_clicked();
|
||
|
};
|
||
|
#endif // MAINWINDOW_H
|