forked from wwderw/embTools
-
Notifications
You must be signed in to change notification settings - Fork 1
/
unitconversion.cpp
85 lines (62 loc) · 1.61 KB
/
unitconversion.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include "unitconversion.h"
#include "ui_unitconversion.h"
unitConversion::unitConversion(QWidget *parent) :
QDialog(parent),
ui(new Ui::unitConversion)
{
ui->setupUi(this);
//Set the Window Titles
setWindowTitle("embTools - Unit Conversions");
}
unitConversion::~unitConversion()
{
delete ui;
}
void unitConversion::on_in_valueChanged(double arg1)
{
double in = ui -> in -> value();
double answer = in * 25.4;
ui -> mm -> setValue(answer);
}
void unitConversion::on_mm_valueChanged(double arg1)
{
double mm = ui -> mm -> value();
double answer = mm / 25.4;
ui -> in -> setValue(answer);
}
void unitConversion::on_in1_valueChanged(double arg1)
{
double in = ui -> in1 -> value();
double answer = in / 0.39370;
ui -> cm -> setValue(answer);
}
void unitConversion::on_cm_valueChanged(double arg1)
{
double cm = ui -> cm -> value();
double answer = cm * 0.39370;
ui -> in1 -> setValue(answer);
}
void unitConversion::on_px_valueChanged(double arg1)
{
double px = ui -> px -> value();
double answer = px * 0.2645833333;
ui -> mm1 -> setValue(answer);
}
void unitConversion::on_mm1_valueChanged(double arg1)
{
double mm = ui -> mm1 -> value();
double answer = mm / 0.2645833333;
ui -> px -> setValue(answer);
}
void unitConversion::on_in2_valueChanged(double arg1)
{
double in = ui -> in2 -> value();
double answer = in * 72;
ui -> pts -> setValue(answer);
}
void unitConversion::on_pts_valueChanged(double arg1)
{
double pts = ui -> pts -> value();
double answer = pts / 72;
ui -> in2 -> setValue(answer);
}