-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmachineoptions.cpp
80 lines (70 loc) · 2.54 KB
/
machineoptions.cpp
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
72
73
74
75
76
77
78
79
80
#include "machineoptions.h"
MachineOptions::MachineOptions(QWidget *parent) :
QWidget(parent) {
machineLayout = new QVBoxLayout(this);
setParent(parent);
createMachineLayout();
setLayout(machineLayout);
}
void MachineOptions::createMachineLayout() {
QLabel *xlable = new QLabel(tr("Длина рабочей зоны по оси X"));
QLabel *ylable = new QLabel(tr("Длина рабочей зоны по оси Y"));
QLabel *zlable = new QLabel(tr("Длина рабочей зоны по оси Z"));
QLabel *flable = new QLabel(tr("Радиус поворота вокруг оси F"));
QLabel *blankLable = new QLabel(tr("Максимальный размер заготовки"));
xAreaEdit = new QLineEdit();
yAreaEdit = new QLineEdit();
zAreaEdit = new QLineEdit();
fAreaEdit = new QLineEdit();
blankAreaEdit = new QLineEdit();
xChildLay = new QHBoxLayout();
yChildLay = new QHBoxLayout();
zChildLay = new QHBoxLayout();
fChildLay = new QHBoxLayout();
blankChildLay = new QHBoxLayout();
makeTempLayout(xChildLay, xlable, xAreaEdit, machineLayout);
makeTempLayout(yChildLay, ylable, yAreaEdit, machineLayout);
makeTempLayout(zChildLay, zlable, zAreaEdit, machineLayout);
makeTempLayout(fChildLay, flable, fAreaEdit, machineLayout);
makeTempLayout(blankChildLay, blankLable, blankAreaEdit, machineLayout);
}
void MachineOptions::makeTempLayout(QHBoxLayout *child,
QLabel *lable, QLineEdit* edit, QBoxLayout* parent) {
edit->setValidator(new QDoubleValidator());
child->addSpacing(1);
child->addWidget(lable);
child->addSpacing(1);
child->addWidget(edit);
child->addSpacing(1);
parent->addLayout(child);
}
double MachineOptions::getXArea(){
return xAreaEdit->text().toDouble();
}
double MachineOptions::getYArea(){
return yAreaEdit->text().toDouble();
}
double MachineOptions::getZArea(){
return zAreaEdit->text().toDouble();
}
double MachineOptions::getFArea(){
return fAreaEdit->text().toDouble();
}
double MachineOptions::getBlankArea(){
return blankAreaEdit->text().toDouble();
}
void MachineOptions::setXArea(double x){
xAreaEdit->setText(tr("%1").arg(x));
}
void MachineOptions::setYArea(double y){
yAreaEdit->setText(tr("%1").arg(y));
}
void MachineOptions::setZArea(double z){
zAreaEdit->setText(tr("%1").arg(z));
}
void MachineOptions::setFArea(double f){
fAreaEdit->setText(tr("%1").arg(f));
}
void MachineOptions::setBlankArea(double blank){
blankAreaEdit->setText(tr("%1").arg(blank));
}