-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgradeclass.cpp
63 lines (48 loc) · 1.45 KB
/
gradeclass.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 "gradeclass.h"
GradeClass::GradeClass(QSpinBox *gCSpinBox, QLabel *gCLabel, double gCWeight, double gCGradeValue, int gCIndexValue, bool gCValueIsKnown, QObject* parent):
gradeClassSpinBox(gCSpinBox),
gradeClassLable(gCLabel),
gradeClassWeight(gCWeight),
gradeClassGradeValue(gCGradeValue),
indexValue(gCIndexValue),
valueIsKnown(gCValueIsKnown),
QObject(parent)
{
}
GradeClass::~GradeClass() {
delete gradeClassSpinBox;
delete gradeClassLable;
}
QSpinBox* GradeClass::getSpinBox() {
return this->gradeClassSpinBox;
}
QLabel* GradeClass::getLabel() {
return this->gradeClassLable;
}
double GradeClass::getWeight() {
return this->gradeClassWeight;
}
double GradeClass::getValue() {
return this->gradeClassGradeValue;
}
int GradeClass::getIndexValue() {
return this->indexValue;
}
bool GradeClass::isValueKnown() {
return this->valueIsKnown;
}
void GradeClass::updateValue(int newValue) {
this->gradeClassGradeValue = newValue;
emit readyToRecalculate();
}
void GradeClass::hideLabelAndSpinBox(QString newString) {
if (newString == gradeClassLable->text()) {
this->gradeClassSpinBox->setDisabled(true);
this->gradeClassLable->setDisabled(true);
} else if(!this->valueIsKnown){
this->gradeClassSpinBox->setDisabled(false);
this->gradeClassLable->setDisabled(false);
this->gradeClassSpinBox->clearFocus();
}
emit readyToRecalculate();
}