FactDev  0.1
contributoriestablemodel.h
1 #ifndef CONTRIBUTORIESTABLEMODEL_H
2 #define CONTRIBUTORIESTABLEMODEL_H
3 #include <QObject>
4 #include <QAbstractTableModel>
5 
6 #include "models/contributory.h"
7 #include "models/rate.h"
8 
9 #include "utils/log.h"
10 
11 using namespace Models;
12 using namespace Utils;
13 
14 namespace Gui {
15 namespace Widgets {
16 namespace WdgModels {
17 
24 class ContributoriesTableModel : public QAbstractTableModel
25 {
26 public:
32  ContributoriesTableModel(QObject* parent = 0);
34 
39  int rowCount(const QModelIndex &) const;
40 
46  int columnCount(const QModelIndex &) const;
47 
54  QVariant data(const QModelIndex &index, int role) const;
55 
63  QVariant headerData(
64  int section, Qt::Orientation orientation, int role) const;
65 
73  bool setData(const QModelIndex & index,
74  const QVariant & value,
75  int role = Qt::EditRole);
76 
81  void append(const Contributory & contributory);
82 
87  void remove(const int i);
88 
94  Qt::ItemFlags flags(const QModelIndex & index) const ;
95 
101  QList<Contributory> getContributories();
102 
107  int count();
108 
114  double getSumQuantity() const;
115 
119  void clear();
120 private:
121  QList<Contributory> _contributories;
122  QList<Contributory> _contributoriesToRemoved;
123 };
124 }
125 }
126 }
127 
128 #endif // CONTRIBUTORIESTABLEMODEL_H
The ContributoriesTableModel class for a custom table for contributories widget.
Definition: contributoriestablemodel.h:24
The Unit enum Unity of work : hour or day.
Definition: contributory.h:18