-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTDBRefillDialog.cpp
70 lines (57 loc) · 1.59 KB
/
TDBRefillDialog.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
#include "TDBRefillDialog.h"
TDBRefillDialog::TDBRefillDialog(QWidget* parent) :
QDialog(parent)
{
setWindowTitle("Approvisionnement");
valid = new QDoubleValidator(this);
money_label = new QLabel("Montant", this);
money_edit = new QLineEdit(this);
money_edit->setValidator(valid);
reason_label = new QLabel("Mode", this);
reason_combo = new QComboBox(this);
reason_combo->addItem("Espèce", 1);
reason_combo->addItem("Chèque", 2);
layout = new QGridLayout(this);
layout->addWidget(money_label, 0,0);
layout->addWidget(money_edit, 0, 1);
layout->addWidget(reason_label, 1, 0);
layout->addWidget(reason_combo, 1, 1);
ok_button = new QPushButton("OK", this);
layout->addWidget(ok_button, 2,0);
cancel_button = new QPushButton("Cancel", this);
layout->addWidget(cancel_button, 2, 1);
setLayout(layout);
connect(cancel_button, SIGNAL(pressed()), this, SLOT(cancel_pressed()));
connect(ok_button, SIGNAL(pressed()), this, SLOT(ok_pressed()));
money_edit->setFocus(Qt::PopupFocusReason);
}
TDBRefillDialog::~TDBRefillDialog()
{
delete layout;
delete money_label;
delete reason_combo;
delete money_edit;
delete reason_label;
delete ok_button;
delete cancel_button;
delete valid;
}
void TDBRefillDialog::cancel_pressed()
{
reject();
}
void TDBRefillDialog::ok_pressed()
{
accept();
}
QString TDBRefillDialog::reason()
{
switch(reason_combo->currentIndex())
{
case 0:
return "espèce";
case 1:
return "chèque";
}
return QString();
}