FactDev  0.1
customerstablemodel.h
1 #ifndef CUSTOMERSTABLEMODEL_H
2 #define CUSTOMERSTABLEMODEL_H
3 #include <QObject>
4 #include <QAbstractTableModel>
5 
6 #include "models/customer.h"
7 #include "utils/log.h"
8 
9 using namespace Models;
10 using namespace Utils;
11 
12 namespace Gui {
13 namespace Widgets {
14 namespace WdgModels {
15 
21 class CustomersTableModel : public QAbstractTableModel
22 {
23 public:
29  CustomersTableModel(QObject* parent = 0);
31 
32 
37  int rowCount(const QModelIndex &) const;
38 
43  int columnCount(const QModelIndex &) const;
44 
51  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
52 
60  QVariant headerData(int section,
61  Qt::Orientation orientation,
62  int role = Qt::DisplayRole) const;
63 
71  bool setData(const QModelIndex & index, const QVariant & value,
72  int role = Qt::EditRole);
73 
78  void append(const Customer &customer);
79 
84  void remove(const int i);
85 
91  Qt::ItemFlags flags(const QModelIndex & index) const ;
92 
97  int count();
98 
103  QList<Customer> getCustomers() const;
104 
105 private:
106  QList<Customer> _customers;
107 };
108 }
109 }
110 }
111 #endif // CUSTOMERSTABLEMODEL_H
The CustomersTableModel class for a customer table.
Definition: customerstablemodel.h:21
The Customer class Customer.
Definition: customer.h:15