Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef LEGENDTABLEDELEGATE_H
00029 #define LEGENDTABLEDELEGATE_H
00030
00031 #include "SciFigsDLLExport.h"
00032 #include "LegendTable.h"
00033
00034 namespace SciFigs {
00035
00036 class SCIFIGS_EXPORT LegendTableDelegate : public QItemDelegate
00037 {
00038 Q_OBJECT
00039 public:
00040 LegendTableDelegate(QObject * parent=0) : QItemDelegate(parent) {}
00041
00042 void setColumnIndexes(const QHash<int,LegendTable::Column> * columnIndexes);
00043
00044 virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
00045 const QModelIndex &index) const;
00046 virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
00047 virtual void setModelData(QWidget *editor, QAbstractItemModel *model,
00048 const QModelIndex &index) const;
00049 virtual QSize sizeHint (const QStyleOptionViewItem & option, const QModelIndex & index) const;
00050 virtual void paint (QPainter * painter, const QStyleOptionViewItem & option,
00051 const QModelIndex & index) const;
00052 public slots:
00053 void colorClicked(const QModelIndex& index);
00054 private slots:
00055 void commitWidget(QWidget * w=0);
00056 signals:
00057 void dataChanged() const;
00058 private:
00059 LegendTable::Column column(int index) const;
00060 const QHash<int,LegendTable::Column> * _columnIndexes;
00061 mutable QModelIndex _colorIndex;
00062 };
00063
00064 }
00065
00066 #endif // LEGENDTABLEDELEGATE_H