This repository has been archived on 2024-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
justhomework/SoftwareDesign/Code/Lab2-3_Calculator4490_v3/mainwindow.h

49 lines
815 B
C
Raw Normal View History

2022-04-19 10:03:16 +00:00
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QKeyEvent>
#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 keyPressEvent(QKeyEvent *e);
//终止运算,清除数据,报错
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 operatorClicked();
};
#endif // MAINWINDOW_H