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/Lab3/Lab3-2-2_Calculator4490_v5/mainwindow.h

50 lines
850 B
C
Raw Permalink Normal View History

2022-05-07 08:21:38 +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();
void on_actionPaste_triggered();
};
#endif // MAINWINDOW_H