-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathovertimedialog.cpp
61 lines (49 loc) · 1.32 KB
/
overtimedialog.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
#include "overtimedialog.h"
#include "ui_overtimedialog.h"
OvertimeDialog::OvertimeDialog(int overtimefull, int overtimehalf, double salary,QWidget *parent) :
QDialog(parent),
ui(new Ui::OvertimeDialog)
{
ui->setupUi(this);
m_full = overtimefull;
m_half = overtimehalf;
m_salary = salary;
connect(ui->doubleSpinBox,SIGNAL(valueChanged(double)),this,SLOT(salaryChangedSlot(double)));
ui->overtimeFull->setText(QString::number(overtimefull));
ui->overtimeHalf->setText(QString::number(overtimehalf));
ui->total->setText("R$ 0,00");
if(salary > 0)
{
ui->doubleSpinBox->setValue(salary);
salaryChangedSlot(salary);
}
}
double OvertimeDialog::getSalary()
{
return m_salary;
}
void OvertimeDialog::salaryChangedSlot(double salary)
{
m_salary = salary;
double half = 0;
double full = 0;
double salarybyhour = salary / 200;
half = (salarybyhour * 1.5) * m_half;
full = (salarybyhour * 2) * m_full;
ui->total->setText(QString("R$ %1").arg(QString::number(half+full,'F',2)));
}
OvertimeDialog::~OvertimeDialog()
{
delete ui;
}
void OvertimeDialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}