Repository navigation
Expand file tree
/
Copy patheditor_attribute.cpp
More file actions
71 lines (63 loc) · 1.6 KB
/
Copy patheditor_attribute.cpp
File metadata and controls
71 lines (63 loc) · 1.6 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "editor_attribute.h"
#include "ui_editor_attribute.h"
editor_attribute::editor_attribute(QWidget *parent)
: QWidget(parent)
, ui(new Ui::editor_attribute)
{
ui->setupUi(this);
}
editor_attribute::editor_attribute(QString label, AttributeModifier* spec, QWidget *parent)
: QWidget(parent)
, ui(new Ui::editor_attribute)
, m_spec(spec)
{
ui->setupUi(this);
ui->AttributeLabel->setText(label);
ui->ValueSpinBox->setValue(m_spec->value);
ui->lineEdit->setText(m_spec->description);
switch (m_spec->op) {
case ModifierOp::Minus:
ui->OperrandButton->setText("-");
break;
case ModifierOp::Plus:
ui->OperrandButton->setText("+");
break;
case ModifierOp::Multiply:
ui->OperrandButton->setText("x");
break;
}
}
editor_attribute::~editor_attribute()
{
delete ui;
}
void editor_attribute::on_OperrandButton_clicked()
{
switch (m_spec->op) {
case ModifierOp::Plus:
ui->OperrandButton->setText("-");
m_spec->op = ModifierOp::Minus;
break;
case ModifierOp::Minus:
ui->OperrandButton->setText("x");
m_spec->op = ModifierOp::Multiply;
break;
case ModifierOp::Multiply:
ui->OperrandButton->setText("+");
m_spec->op = ModifierOp::Plus;
break;
}
emit Save();
}
void editor_attribute::on_ValueSpinBox_valueChanged(int arg1)
{
if (m_spec)
m_spec->value = arg1;
emit Save();
}
void editor_attribute::on_lineEdit_textChanged(const QString& arg1)
{
if (m_spec)
m_spec->description = arg1;
emit Save();
}