-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvetodelegate.h
47 lines (39 loc) · 1.67 KB
/
vetodelegate.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef VETODELEGATE_H
#define VETODELEGATE_H
#include <QStyledItemDelegate>
#include<QWidget>
class Owner;
class Animal;
class VetoDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
VetoDelegate(QList<Animal*> animal, QObject *parent = 0);
VetoDelegate(QObject *parent = 0);
public:
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE;
void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const Q_DECL_OVERRIDE;
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex & index ) const Q_DECL_OVERRIDE;
QList<Animal *> getListAnimal();
static QList<Owner*> getListOwner();
void setListAnimal(QList<Animal*> animal);
private:
static QList<Animal*> m_animal;
static QList<Owner*> m_owner;
signals:
void sendData(QString s)const ;
};
class ModelTest : public QStyledItemDelegate
{
Q_OBJECT
public:
ModelTest(QObject *parent = 0);
public:
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
void setEditorData(QWidget *editor, const QModelIndex &index) const override;
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex & index ) const override;
// QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE;
};
#endif // VETODELEGATE_H