-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompoundwidget.cpp
More file actions
46 lines (35 loc) · 956 Bytes
/
compoundwidget.cpp
File metadata and controls
46 lines (35 loc) · 956 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
#include "compoundwidget.h"
#include "ui_compoundwidget.h"
#include <QMessageBox>
CompoundWidget::CompoundWidget(const std::vector<Expr>& expression,QWidget *parent)
: QWidget(parent)
, ui(new Ui::CompoundWidget)
{
ui->setupUi(this);
for(size_t i = 0; i < expression.size(); ++i)
{
ui->OprandBox1->addItem(expression[i].prefix);
ui->OprandBox2->addItem(expression[i].prefix);
}
}
CompoundWidget::~CompoundWidget()
{
delete ui;
}
void CompoundWidget::on_exitButton_clicked()
{
this->close();
}
void CompoundWidget::on_readButton_clicked()
{
QString s = ui->opComboBox->currentText() + ui->OprandBox1->currentText() + ui->OprandBox2->currentText();
if(validPrefix(s))
{
emit returnExpr(createExpr(s));
QMessageBox::information(this,"提示","表达式输入成功");
}
else
{
QMessageBox::warning(this,"警告","无效的前缀的表达式");
}
}