-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeinmodel.h
28 lines (21 loc) · 829 Bytes
/
meinmodel.h
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
#ifndef MEINMODEL_H
#define MEINMODEL_H
#include <QSqlRelationalTableModel>
class MeinModel : public QSqlRelationalTableModel
{
Q_OBJECT
public:
explicit MeinModel(QObject *parent = nullptr);
~MeinModel();
Q_INVOKABLE QVariant data(const QModelIndex &index, int role=Qt::DisplayRole ) const;
Q_INVOKABLE QVariant getRelation(const QModelIndex &item, int role = Qt::EditRole);
Q_INVOKABLE QVariant hasRelation(const QModelIndex &item, QVariant value);
void generateRoleNames();
Q_INVOKABLE virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) ;
Q_INVOKABLE void updateModel();
Q_INVOKABLE void deleteRows(const QList<int> rows);
private:
QHash<int, QByteArray> roles;
QList<MeinModel> *mData;
};
#endif // MEINMODEL_H