-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrendmodel.cpp
More file actions
46 lines (38 loc) · 1019 Bytes
/
Copy pathtrendmodel.cpp
File metadata and controls
46 lines (38 loc) · 1019 Bytes
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
#include "trendmodel.h"
TrendModel::TrendModel(QObject *parent)
: QAbstractTableModel(parent)
{}
int TrendModel::rowCount(const QModelIndex &parent) const
{
if (parent.isValid())
return 0;
return m_records.size();
}
int TrendModel::columnCount(const QModelIndex &parent) const
{
if (parent.isValid())
return 0;
return ColumnCount;
}
QVariant TrendModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid() || index.row() < 0 || index.row() >= m_records.size()
|| role != Qt::DisplayRole) {
return {};
}
const TrendRecord &record = m_records.at(index.row());
switch (index.column()) {
case TimeColumn:
return record.time;
case HeartRateColumn:
return record.heartRate;
case OxygenSaturationColumn:
return record.oxygenSaturation;
case RespiratoryRateColumn:
return record.respiratoryRate;
case NibpColumn:
return record.nibp;
default:
return {};
}
}