-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdialogchangeroute.cpp
More file actions
46 lines (42 loc) · 1.15 KB
/
Copy pathdialogchangeroute.cpp
File metadata and controls
46 lines (42 loc) · 1.15 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
#include "dialogchangeroute.h"
#include "ui_dialogchangeroute.h"
#include "sql.h"
#include <QPushButton>
#include <QIntValidator>
DialogChangeRoute::DialogChangeRoute(QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogChangeRoute)
{
ui->setupUi(this);
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
ui->lowRange->setValidator(new QIntValidator(1,999));
ui->highRange->setValidator(new QIntValidator(1,999));
connect(ui->highRange, &QLineEdit::editingFinished, [=]{
lowRange =ui->lowRange->text().toInt();
highRange = ui->highRange->text().toInt();
if(highRange - lowRange > 1)
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
else
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
});
connect(ui->buttonBox->button(QDialogButtonBox::Ok), &QPushButton::clicked, [=]{
int result = SQL::instance()->nextRouteNumberInRange(lowRange, highRange);
if(result > 0 && result < highRange)
{
number = result+1;
accept();
}
});
}
DialogChangeRoute::~DialogChangeRoute()
{
delete ui;
}
int DialogChangeRoute::getNumber()
{
return number;
}
QString DialogChangeRoute::get_aRoute()
{
return "??";
}