attributedelegate.h
changeset 770 57ce1ba6d1cb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/attributedelegate.h	Mon May 18 09:41:31 2009 +0000
     1.3 @@ -0,0 +1,37 @@
     1.4 +
     1.5 +#ifndef ATTRIBUTEDELEGATE_H
     1.6 +#define ATTRIBUTEDELEGATE_H
     1.7 +
     1.8 +#include <QItemDelegate>
     1.9 +#include <QModelIndex>
    1.10 +#include <QObject>
    1.11 +#include <QSize>
    1.12 +#include <QSpinBox>
    1.13 +#include <QLineEdit>
    1.14 +
    1.15 +#include "attribute.h"
    1.16 +
    1.17 +class AttributeDelegate : public QItemDelegate
    1.18 +{
    1.19 +    Q_OBJECT
    1.20 +
    1.21 +enum EditorType {Undefined,SpinBox,LineEdit,ComboBox};
    1.22 +
    1.23 +public:
    1.24 +    AttributeDelegate(QObject *parent = 0);
    1.25 +
    1.26 +    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
    1.27 +                          const QModelIndex &index) const;
    1.28 +
    1.29 +    void setEditorData(QWidget *editor, const QModelIndex &index) const ;
    1.30 +    void setModelData(QWidget *editor, QAbstractItemModel *model,
    1.31 +                      const QModelIndex &index) const ;
    1.32 +
    1.33 +	void updateEditorGeometry(QWidget *editor,
    1.34 +	const QStyleOptionViewItem &option, const QModelIndex &index) const;
    1.35 +	void setAttributeTable(AttributeTable *table);
    1.36 +private:
    1.37 +	AttributeTable *attributeTable;
    1.38 +};
    1.39 +
    1.40 +#endif