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 LEGENDTABLEITEM_H
00029 #define LEGENDTABLEITEM_H
00030
00031 #include "LegendTable.h"
00032
00033 namespace SciFigs {
00034
00035 class LegendTableItem : public QAbstractTableModel
00036 {
00037 Q_OBJECT
00038 public:
00039 LegendTableItem(QObject * parent=0);
00040
00041 void setLegend(Legend * legend);
00042 void setColumnIndexes(const QHash<int,LegendTable::Column> * columnIndexes);
00043
00044 void setReadOnlyText(bool ro) {_readOnlyText=ro;}
00045 bool readOnlyText() const {return _readOnlyText;}
00046
00047 void setOneColor(bool oc) {_oneColor=oc;}
00048 bool oneColor() const {return _oneColor;}
00049
00050 virtual int rowCount(const QModelIndex &parent=QModelIndex()) const;
00051 virtual int columnCount(const QModelIndex &parent=QModelIndex()) const;
00052 virtual QVariant data(const QModelIndex &index, int role) const;
00053 virtual bool setData (const QModelIndex & index, const QVariant & value, int role=Qt::EditRole);
00054 virtual Qt::ItemFlags flags (const QModelIndex & ) const;
00055 private:
00056 void setColor(int row, const QColor& c);
00057 LegendTable::Column column(int index) const;
00058 const QHash<int,LegendTable::Column> * _columnIndexes;
00059
00060 int _readOnlyText:1;
00061 int _oneColor:1;
00062
00063 Legend * _legend;
00064 };
00065
00066 }
00067
00068 #endif // LEGENDTABLEITEM_H