stec-platform
residentabstracttablemodel.h
1 #ifndef RESIDENTABSTRACTTABLEMODEL_H
2 #define RESIDENTABSTRACTTABLEMODEL_H
3 /*
4 *
5 * $LastChangedDate: 2019-09-11 16:10:31 -0400 (Wed, 11 Sep 2019) $
6 * $LastChangedBy: ed $
7 * $Revision: 2030 $
8 * $Author: ed $
9 * $URL: svn+ssh://svn.vremsoft.com/var/share/svn/tags/platfom3.4.3/platformutilitylib/residentabstracttablemodel.h $
10 * $Id: residentabstracttablemodel.h 2030 2019-09-11 20:10:31Z ed $
11 * edc@vremsoft.com
12 *
13 * 19
14 *
15 * *** 2014<c> ***
16 *
17 *
18 */
19 
20 
21 #include "platformu_global.h"
22 #include <QAbstractTableModel>
23 #include <QString>
24 #include <QMap>
25 #include <QList>
26 #include <QVariant>
27 #include <QPair>
28 
29 class Resident;
30 
35 class PLATFORMUSHARED_EXPORT ResidentAbstractTableModel : public QAbstractTableModel
36 {
37  Q_OBJECT
38 
39 private :
40  Resident *ResidentDBX;
41  QList<QString> Headers;
42 
43  int nbrCol;
44  QList<QPair<QString, QList<QVariant> > > listOfPairs;
45 
46 public:
47  explicit ResidentAbstractTableModel(Resident *rdb, QObject *parent = nullptr);
48 
49  explicit ResidentAbstractTableModel(QList<QString> headers, QObject *parent = nullptr);
50  explicit ResidentAbstractTableModel( QObject *parent = nullptr);
51 
52  virtual void setDataBase( Resident *rdb );
53 
54  QVariant data ( const QModelIndex &index, int role ) const;
55  int columnCount ( const QModelIndex &parent ) const;
56  int rowCount ( const QModelIndex &parent ) const;
57  Qt::ItemFlags flags ( const QModelIndex &index ) const;
58  QVariant headerData ( int section, Qt::Orientation orientation, int role ) const;
59 
60  virtual bool removeRows ( int position, int rows, const QModelIndex &index );
61  virtual bool insertRows ( int position, int rows, const QModelIndex &index );
62  virtual bool setData ( const QModelIndex &index, const QVariant &value, int role );
63 
64  void save(void);
65 
66 signals:
67  void signal_save(QList<QString> headers, QMap<QString,QList<QVariant> > dbx );
68 
69 public slots:
70  void slot_databaseChanged();
71  void slot_newDbx(QList<QString> headers, QMap<QString,QList<QVariant> > dbx );
72 
73 };
74 
75 #endif // RESIDENTABSTRACTTABLEMODEL_H
The ResidentAbstractTableModel class.
Definition: residentabstracttablemodel.h:36
The Resident class.
Definition: resident.h:32