attributedelegate.h
changeset 678 fd6d1292c4ad
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/attributedelegate.h	Mon Mar 03 09:25:40 2008 +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