-
Notifications
You must be signed in to change notification settings - Fork 7
/
askIntervalDialog.cpp
50 lines (42 loc) · 1.16 KB
/
askIntervalDialog.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
/* OpenBRF -- by marco tarini. Provided under GNU General Public License */
#include "askIntervalDialog.h"
#include "ui_askIntervalDialog.h"
#include <QPushButton>
AskIntervalDialog::AskIntervalDialog(QWidget *parent, QString title, int a, int b) :
QDialog(parent),
ui(new Ui::AskIntervalDialog)
{
ui->setupUi(this);
ui->title->setText(title);
ui->from->setText(QString::number(a));
ui->to->setText(QString::number(b));
validate();
connect(ui->from, SIGNAL(textEdited(QString)), this, SLOT(validate()));
connect(ui->to, SIGNAL(textEdited(QString)), this, SLOT(validate()));
}
void AskIntervalDialog::validate(){
int a = ui->from->text().toInt();
int b = ui->to->text().toInt();
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(a<b);
}
int AskIntervalDialog::getA(){
return ui->from->text().toInt();
}
int AskIntervalDialog::getB(){
return ui->to->text().toInt();
}
AskIntervalDialog::~AskIntervalDialog()
{
delete ui;
}
void AskIntervalDialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}