attributedelegate.h
author insilmaril
Tue Jun 03 08:33:03 2008 +0000 (2008-06-03)
changeset 708 02f683ded030
permissions -rw-r--r--
Workaround for unreadable file with Qt 4.4
insilmaril@678
     1
insilmaril@678
     2
#ifndef ATTRIBUTEDELEGATE_H
insilmaril@678
     3
#define ATTRIBUTEDELEGATE_H
insilmaril@678
     4
insilmaril@678
     5
#include <QItemDelegate>
insilmaril@678
     6
#include <QModelIndex>
insilmaril@678
     7
#include <QObject>
insilmaril@678
     8
#include <QSize>
insilmaril@678
     9
#include <QSpinBox>
insilmaril@678
    10
#include <QLineEdit>
insilmaril@678
    11
insilmaril@678
    12
#include "attribute.h"
insilmaril@678
    13
insilmaril@678
    14
class AttributeDelegate : public QItemDelegate
insilmaril@678
    15
{
insilmaril@678
    16
    Q_OBJECT
insilmaril@678
    17
insilmaril@678
    18
enum EditorType {Undefined,SpinBox,LineEdit,ComboBox};
insilmaril@678
    19
insilmaril@678
    20
public:
insilmaril@678
    21
    AttributeDelegate(QObject *parent = 0);
insilmaril@678
    22
insilmaril@678
    23
    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
insilmaril@678
    24
                          const QModelIndex &index) const;
insilmaril@678
    25
insilmaril@678
    26
    void setEditorData(QWidget *editor, const QModelIndex &index) const ;
insilmaril@678
    27
    void setModelData(QWidget *editor, QAbstractItemModel *model,
insilmaril@678
    28
                      const QModelIndex &index) const ;
insilmaril@678
    29
insilmaril@678
    30
	void updateEditorGeometry(QWidget *editor,
insilmaril@678
    31
	const QStyleOptionViewItem &option, const QModelIndex &index) const;
insilmaril@678
    32
	void setAttributeTable(AttributeTable *table);
insilmaril@678
    33
private:
insilmaril@678
    34
	AttributeTable *attributeTable;
insilmaril@678
    35
};
insilmaril@678
    36
insilmaril@678
    37
#endif