-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtemperaturestab.cpp
87 lines (75 loc) · 3.24 KB
/
temperaturestab.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
86
87
#include "temperaturestab.h"
#include <QtGui>
#include <QGridLayout>
#include <QVBoxLayout>
#include <QGroupBox>
#include <QTableView>
#include <QHeaderView>
TemperaturesTab::TemperaturesTab(QWidget *parent) :
QWidget(parent)
{
//overall grid layout
QGridLayout *overallLayout = new QGridLayout();
//group box for measured temperatures
QGroupBox *measuredTempsGroup = new QGroupBox("Measured Temperatures 0x30c9");
QVBoxLayout *measuredTempsLayout = new QVBoxLayout();
measuredTempsTable = new QTableView();
measuredTempsTable->verticalHeader()->hide();
measuredTempsLayout->addWidget(measuredTempsTable);
measuredTempsGroup->setLayout(measuredTempsLayout);
overallLayout->addWidget(measuredTempsGroup, 0, 0, 1, 1);
//group box for setpoints
QGroupBox *setpointsGroup = new QGroupBox("Setpoints 0x2309");
QVBoxLayout *setpointsLayout = new QVBoxLayout();
setpointsTable = new QTableView();
setpointsTable->verticalHeader()->hide();
setpointsLayout->addWidget(setpointsTable);
setpointsGroup->setLayout(setpointsLayout);
overallLayout->addWidget(setpointsGroup, 0, 1, 1, 1);
//group box for TRV demands
QGroupBox *demandsGroup = new QGroupBox("Demand 0x3150");
QVBoxLayout *demandsLayout = new QVBoxLayout();
demandsTable = new QTableView();
demandsTable->verticalHeader()->hide();
demandsLayout->addWidget(demandsTable);
demandsGroup->setLayout(demandsLayout);
overallLayout->addWidget(demandsGroup, 0, 2, 2, 1);
//group box for programmer now / next info
QGroupBox *nowNextGroup = new QGroupBox("Programmer now/next 0x2249");
QVBoxLayout *nowNextLayout = new QVBoxLayout();
nowNextTable = new QTableView();
nowNextTable->verticalHeader()->hide();
nowNextLayout->addWidget(nowNextTable);
nowNextGroup->setLayout(nowNextLayout);
overallLayout->addWidget(nowNextGroup, 0, 3, 1, 1);
//set the layout for the whole tab
this->setLayout(overallLayout);
}
void TemperaturesTab::setMeasuredTempsModel(QAbstractTableModel *m)
{
measuredTempsTable->setModel(m);
connect(m, SIGNAL(layoutChanged()), measuredTempsTable, SLOT(resizeColumnsToContents()));
connect(m, SIGNAL(layoutChanged()), measuredTempsTable, SLOT(resizeRowsToContents()));
measuredTempsTable->resizeColumnsToContents();
}
void TemperaturesTab::setSetpointsModel(QAbstractTableModel *m)
{
setpointsTable->setModel(m);
connect(m, SIGNAL(layoutChanged()), setpointsTable, SLOT(resizeColumnsToContents()));
connect(m, SIGNAL(layoutChanged()), setpointsTable, SLOT(resizeRowsToContents()));
setpointsTable->resizeColumnsToContents();
}
void TemperaturesTab::setDemandsModel(QAbstractTableModel *m)
{
demandsTable->setModel(m);
connect(m, SIGNAL(layoutChanged()), demandsTable, SLOT(resizeColumnsToContents()));
connect(m, SIGNAL(layoutChanged()), demandsTable, SLOT(resizeRowsToContents()));
demandsTable->resizeColumnsToContents();
}
void TemperaturesTab::setProgNowNextModel(QAbstractTableModel *m)
{
nowNextTable->setModel(m);
connect(m, SIGNAL(layoutChanged()), nowNextTable, SLOT(resizeColumnsToContents()));
connect(m, SIGNAL(layoutChanged()), nowNextTable, SLOT(resizeRowsToContents()));
nowNextTable->resizeColumnsToContents();
}