-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinputwidget.cpp
More file actions
51 lines (40 loc) · 860 Bytes
/
inputwidget.cpp
File metadata and controls
51 lines (40 loc) · 860 Bytes
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
#include "inputwidget.h"
#include "ui_inputwidget.h"
#include <QMessageBox>
#include "ExprStruct.h"
InputWidget::InputWidget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::InputWidget)
{
ui->setupUi(this);
}
InputWidget::~InputWidget()
{
delete ui;
}
void InputWidget::on_clearButton_clicked()
{
ui->lineEdit->clear();
}
void InputWidget::on_readButton_clicked()
{
QString s = ui->lineEdit->text();
if(validPrefix(s))
{
expressions.push_back(createExpr(s));
QMessageBox::information(this,"提示","表达式输入成功");
}
else
{
QMessageBox::warning(this,"警告","无效的前缀的表达式");
}
}
void InputWidget::on_exitButton_clicked()
{
this->close();
}
void InputWidget::closeEvent(QCloseEvent* event)
{
emit returnExpr(expressions);
event->accept();
}