-
Notifications
You must be signed in to change notification settings - Fork 0
/
inputdimension.cpp
65 lines (50 loc) · 1.54 KB
/
inputdimension.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
#include "inputdimension.h"
#include "ui_inputdimension.h"
#include "opengl/glvolume.h"
extern VOLUME grid;
QString gHeight = "1";
QString gWidth = "1";
QString gLength = "1";
QString Height = "128";
QString Width = "128";
QString Length = "128";
bool pressCancel = false;
InputDimension::InputDimension(QWidget *parent) :
QDialog(parent),
ui(new Ui::InputDimension)
{
ui->setupUi(this);
this->setWindowTitle("Dimension");
this->ui->grid_height_Edit->setText(gHeight);
this->ui->grid_width_Edit->setText(gWidth);
this->ui->grid_length_Edit->setText(gLength);
this->ui->height_Edit->setText(Height);
this->ui->width_Edit->setText(Width);
this->ui->length_Edit->setText(Length);
}
InputDimension::~InputDimension()
{
}
void InputDimension::on_buttonBox_accepted()
{
QRegExpValidator* rxv = new QRegExpValidator(QRegExp("\\d*"), this);
ui ->height_Edit->setValidator(new QIntValidator(0, 100, this));
ui ->width_Edit->setValidator(rxv);
ui ->length_Edit->setValidator(rxv);
Height = this->ui->height_Edit->text();
grid.Nx = Height.toInt();
Width = this->ui->width_Edit->text();
grid.Ny = Width.toInt();
Length = this->ui->length_Edit->text();
grid.Nz = Length.toInt();
gHeight = this->ui->grid_height_Edit->text();
grid.Dx = gHeight.toInt();
gWidth = this->ui->grid_width_Edit->text();
grid.Dy = gWidth.toInt();
gLength = this->ui->grid_length_Edit->text();
grid.Dz = gLength.toInt();
}
void InputDimension::on_buttonBox_rejected()
{
pressCancel = true;
}