initial import
[vym] / attributedelegate.h
1
2 #ifndef ATTRIBUTEDELEGATE_H
3 #define ATTRIBUTEDELEGATE_H
4
5 #include <QItemDelegate>
6 #include <QModelIndex>
7 #include <QObject>
8 #include <QSize>
9 #include <QSpinBox>
10 #include <QLineEdit>
11
12 #include "attribute.h"
13
14 class AttributeDelegate : public QItemDelegate
15 {
16     Q_OBJECT
17
18 enum EditorType {Undefined,SpinBox,LineEdit,ComboBox};
19
20 public:
21     AttributeDelegate(QObject *parent = 0);
22
23     QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
24                           const QModelIndex &index) const;
25
26     void setEditorData(QWidget *editor, const QModelIndex &index) const ;
27     void setModelData(QWidget *editor, QAbstractItemModel *model,
28                       const QModelIndex &index) const ;
29
30         void updateEditorGeometry(QWidget *editor,
31         const QStyleOptionViewItem &option, const QModelIndex &index) const;
32         void setAttributeTable(AttributeTable *table);
33 private:
34         AttributeTable *attributeTable;
35 };
36
37 #endif