-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTDBTransactionDialog.cpp
57 lines (46 loc) · 1.47 KB
/
TDBTransactionDialog.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
#include "TDBTransactionDialog.h"
TDBTransactionDialog::TDBTransactionDialog(QWidget* parent, QString title, QString initial) :
QDialog(parent)
{
setWindowTitle(title);
valid = new QDoubleValidator(this);
money_label = new QLabel("Montant", this);
money_edit = new QLineEdit(initial.append(" "), this); // hack sordide
money_edit->setSelection(1,1);
money_edit->setValidator(valid);
reason_label = new QLabel("Commentaire", this);
reason_edit = new QLineEdit(this);
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_edit, 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);
money_edit->setSelection(1,1);
}
TDBTransactionDialog::~TDBTransactionDialog()
{
delete layout;
delete money_label;
delete reason_label;
delete money_edit;
delete reason_edit;
delete ok_button;
delete cancel_button;
delete valid;
}
void TDBTransactionDialog::cancel_pressed()
{
reject();
}
void TDBTransactionDialog::ok_pressed()
{
accept();
}