-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsemesterbox.cpp
44 lines (38 loc) · 1.21 KB
/
semesterbox.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
#include "semesterbox.h"
SemesterBox::SemesterBox (QWidget* parent, int Isemester)
: QWidget(parent), semester(Isemester)
{
semester_lbl = new QLabel( "Semester " + QString::number(semester));
semester_lbl->setSizePolicy(
QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed)
);
hours_lbl = new QLabel( "Hours: 0");
hours_lbl->setSizePolicy(
QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed)
);
auto lay = new QVBoxLayout();
lay->addWidget(semester_lbl);
lay->addWidget(hours_lbl);
setLayout(lay);
}
CourseController* SemesterBox::newController(Course *Icourse, Qt::WindowFlags fl) {
CourseController* cont =
new CourseController(Icourse, semester, this, fl);
QObject::connect(
cont, SIGNAL( used(QString, float) ),
&courses_used, SLOT( keyUsed(QString, float) )
);
QObject::connect(
cont, SIGNAL( unused(QString, float) ),
&courses_used, SLOT( keyUnused(QString, float) )
);
QObject::connect(
Icourse, SIGNAL( sel_changed() ),
this, SLOT( courseSelChanged() )
);
layout()->addWidget(cont);
return cont;
}
void SemesterBox::courseSelChanged() {
hours_lbl->setText( "Hours: " + QString::number( courses_used.total() ) );
}