-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatients_model.h
More file actions
53 lines (33 loc) · 1.19 KB
/
patients_model.h
File metadata and controls
53 lines (33 loc) · 1.19 KB
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
#ifndef PATIENTS_MODEL_H
#define PATIENTS_MODEL_H
#include <QAbstractTableModel>
#include <vector>
#include <map>
#include "dbmanager.h"
const int COLS = 3;
// Custom model to store patients in std::vector for more explicity
class PatientsModel : public QAbstractTableModel {
Q_OBJECT
public:
PatientsModel(std::vector<Patient *> * PatientsData, QObject * parent = nullptr);
~PatientsModel();
int rowCount(const QModelIndex & index = QModelIndex()) const override;
int columnCount(const QModelIndex & index = QModelIndex()) const override;
QVariant data(const QModelIndex &, int role = Qt::DisplayRole) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
void AddPatient(Patient &);
void DeletePatient(int row);
Patient * GetPatient(int pId) const;
signals:
void itemForRemove(const QModelIndex & index) const;
private:
// Data:
std::vector<Patient *> * m_pPatientsVector;
};
inline int PatientsModel::rowCount(const QModelIndex &) const {
return m_pPatientsVector->size();
}
inline int PatientsModel::columnCount(const QModelIndex &) const {
return COLS;
}
#endif // PATIENTS_MODEL_H