-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSceneSizesInput.cpp
51 lines (43 loc) · 1.17 KB
/
SceneSizesInput.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
#include "SceneSizesInput.h"
#include "ui_SceneSizesInput.h"
#include <QIntValidator>
#include <QMessageBox>
SceneSizesInput::SceneSizesInput(QWidget *parent) :
QDialog(parent),
ui(new Ui::SceneSizesInput)
{
ui->setupUi(this);
sizesValidator = new QIntValidator(200, 20000, this);
ui->ledtLength->setValidator(sizesValidator);
ui->ledtWidth->setValidator(sizesValidator);
}
SceneSizesInput::~SceneSizesInput()
{
delete ui;
}
int SceneSizesInput::GetLength()
{
return length;
}
int SceneSizesInput::GetWidth()
{
return width;
}
void SceneSizesInput::on_btnOk_clicked()
{
int pos = 0;
QString strLength = ui->ledtLength->text();
QString strWidth = ui->ledtWidth->text();
if (sizesValidator->validate(strLength, pos) != QValidator::Acceptable ||
sizesValidator->validate(strWidth, pos) != QValidator::Acceptable)
QMessageBox::warning(this, "Ошибка", "Недопустимое значение размеров сцены");
else
{
emit SceneCreated(ui->ledtLength->text().toInt(), ui->ledtWidth->text().toInt());
accept();
}
}
void SceneSizesInput::on_btnCancel_clicked()
{
reject();
}