FactDev  0.1
projectcontributoriestablemodel.h
1 #ifndef PROJECTCONTRIBUTORIESTABLEMODEL_H
2 #define PROJECTCONTRIBUTORIESTABLEMODEL_H
3 #include <QAbstractTableModel>
4 #include <QSet>
5 #include <QPair>
6 
7 #include "models/project.h"
8 #include "models/rate.h"
9 
10 namespace Gui {
11 namespace Widgets {
12 namespace WdgModels {
13 
19 class ProjectContributoriesTableModel : public QAbstractTableModel
20 {
21 public:
27  ProjectContributoriesTableModel(QObject* parent = 0);
28 
34  int rowCount(const QModelIndex &) const;
35 
41  int columnCount(const QModelIndex &) const;
42 
50  QVariant data(const QModelIndex &index, int role) const;
51 
60  QVariant headerData(
61  int section, Qt::Orientation orientation, int role) const;
62 
70  bool setData(const QModelIndex & index,
71  const QVariant & value,
72  int role = Qt::EditRole);
73 
79  Qt::ItemFlags flags(const QModelIndex & index) const ;
80 
86  void append(QPair<Models::Project *, Models::Rate> p);
87 
92  void append();
93 
99  bool allProjectsChosen();
100 
106  QList<int> &getSelectedProjects();
107 
113  void remove(int index);
114 
121  QPair<Models::Project*, Models::Rate> getProject(const int row);
122 
128  QList<QPair<Models::Project*, Models::Rate> > getProjects(void);
129 
130 private:
132  QList<QPair<Models::Project*, Models::Rate> > _projects;
133  QList<int> _selectedProjects;
134 
135 };
136 
137 }
138 }
139 }
140 
141 #endif // PROJECTCONTRIBUTORIESTABLEMODEL_H
QList< QPair< Models::Project *, Models::Rate > > getProjects(void)
ProjectContributoriesTableModel::getProjects Return a list of the set of projects and their rates lin...
Definition: projectcontributoriestablemodel.cpp:132
QPair< Models::Project *, Models::Rate > getProject(const int row)
ProjectContributoriesTableModel::getProject Return the project and it rate linked which correspond to...
Definition: projectcontributoriestablemodel.cpp:126
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
ProjectContributoriesTableModel::setData Change data of a cell.
Definition: projectcontributoriestablemodel.cpp:58
QList< int > & getSelectedProjects()
ProjectContributoriesTableModel::getSelectedProjects Return the list of the Project id which are sele...
Definition: projectcontributoriestablemodel.cpp:137
bool allProjectsChosen()
ProjectContributoriesTableModel::allProjectsChosen Return TRUE if all projects have been selected els...
Definition: projectcontributoriestablemodel.cpp:108
QVariant headerData(int section, Qt::Orientation orientation, int role) const
ProjectContributoriesTableModel::headerData Obtains header title of table.
Definition: projectcontributoriestablemodel.cpp:38
int columnCount(const QModelIndex &) const
ProjectContributoriesTableModel::columnCount Number of column of a contributory.
Definition: projectcontributoriestablemodel.cpp:18
void append()
ProjectContributoriesTableModel::append Add the current element to the list.
Definition: projectcontributoriestablemodel.cpp:91
Qt::ItemFlags flags(const QModelIndex &index) const
ProjectContributoriesTableModel::flags Differents table flags.
Definition: projectcontributoriestablemodel.cpp:85
QVariant data(const QModelIndex &index, int role) const
ProjectContributoriesTableModel::data Obtains data of a specify cell.
Definition: projectcontributoriestablemodel.cpp:23
The ProjectContributoriesTableModel class Table model of contributories linked to projets...
Definition: projectcontributoriestablemodel.h:19
int rowCount(const QModelIndex &) const
ProjectContributoriesTableModel::rowCount Number of contributories row.
Definition: projectcontributoriestablemodel.cpp:13
ProjectContributoriesTableModel(QObject *parent=0)
ProjectContributoriesTableModel::ProjectContributoriesTableModel Construct a ProjectContributoriesTab...
Definition: projectcontributoriestablemodel.cpp:7