-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtransactionsmodel.h
More file actions
65 lines (43 loc) · 1.75 KB
/
Copy pathtransactionsmodel.h
File metadata and controls
65 lines (43 loc) · 1.75 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
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef TRANSACTIONSMODEL_H
#define TRANSACTIONSMODEL_H
#include <vector>
#include <QAbstractItemModel>
#include "database.h"
#include "monthmodel.h"
#include "monthheadermodel.h"
#include "theme.h"
class TransactionsModel : public QAbstractItemModel
{
Q_OBJECT
public:
TransactionsModel(Theme* theme, QObject* parent = NULL);
virtual ~TransactionsModel();
QVariant data(const QModelIndex& index, int role) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex& index) const override;
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
QSize span(const QModelIndex& index) const override;
Qt::ItemFlags flags(const QModelIndex& index) const override;
QString description(const QModelIndex& index) const;
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
bool setDescription(const QModelIndex& index, const QString& desc);
public slots:
void setYear(int year);
void setScores(DataBase::SScore* scores);
void setTheme(Theme* theme);
signals:
void error(const QString& title, const QString& text);
private:
void _initMonth();
int monthForIdx(const QModelIndex& index) const;
int monthForIdx(int idx_row) const;
MonthHeaderModel m_header;
std::vector<MonthModel> m_month;
DataBase::SScore* m_scores;
Theme* m_theme;
std::vector<std::pair<int, int> > m_rowsInMonth;
int m_rows;
};
#endif // TRANSACTIONSMODEL_H