小改
This commit is contained in:
parent
6acdb21e2d
commit
61d50f2668
1 changed files with 9 additions and 3 deletions
|
@ -22,8 +22,8 @@ void MainWindow::abortOperation() {
|
|||
result = 0.0;
|
||||
pendingOperator.clear();
|
||||
ui->lineEdit->setText("0");
|
||||
waitForOperand = true;
|
||||
QMessageBox::warning(this, "运算错误", "除数不能为零");
|
||||
isFinished = false;
|
||||
QMessageBox::warning(this, "运算错误", "算式不合法");
|
||||
}
|
||||
|
||||
//数字被点击
|
||||
|
@ -55,7 +55,13 @@ void MainWindow::on_clearAllBtn_clicked() {
|
|||
}
|
||||
|
||||
void MainWindow::on_equalBtn_clicked() {
|
||||
try {
|
||||
result = cal(displayText.toStdString());
|
||||
}
|
||||
|
||||
catch (...) {
|
||||
abortOperation();
|
||||
}
|
||||
isFinished = 1;
|
||||
ui->lineEdit->setText(QString::number(result));
|
||||
}
|
||||
|
|
Reference in a new issue