-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblockbookingsmodel.h
50 lines (37 loc) · 1.17 KB
/
blockbookingsmodel.h
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
#ifndef BLOCKBOOKINGSMODEL_H
#define BLOCKBOOKINGSMODEL_H
#include <QDate>
#include <QModelIndex>
#include <QObject>
#include <QSqlQuery>
class BlockBookingsModel : public QAbstractTableModel
{
public:
typedef enum
{
MODE_BLOCKS,
MODE_BOOKINGS,
MODE_INFO
} Mode;
BlockBookingsModel(QObject *parent = nullptr);
// Header:
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
// Basic functionality:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
void setMode(Mode mode);
void setBlockId(int id);
void setConditions(const QString& conditions);
QVariant plainData(int row, int col) const;
public slots:
void updateQuery();
private:
QSqlQuery m_query;
QDate m_stat_day, m_end_day;
Mode m_mode = MODE_BLOCKS;
int m_blockid = -1;
QString m_additional_condition;
int m_count = 0;
};
#endif // BLOCKBOOKINGSMODEL_H