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 GRAPHCONTENTLAYERPROPERTIES_H
00029 #define GRAPHCONTENTLAYERPROPERTIES_H
00030
00031 #include "ui_GraphContentLayerProperties.h"
00032 #include "GraphContent.h"
00033
00034 namespace SciFigs {
00035
00036 class LayerPropertiesItem : public QAbstractItemModel
00037 {
00038 Q_OBJECT
00039 public:
00040 LayerPropertiesItem(QObject * parent=0) : QAbstractItemModel(parent) {_graph=0;}
00041
00042 void setGraph(GraphContent * g);
00043
00044 virtual int rowCount(const QModelIndex &parent=QModelIndex()) const;
00045 virtual int columnCount(const QModelIndex &parent=QModelIndex()) const;
00046 virtual QVariant data(const QModelIndex &index, int role) const;
00047 virtual QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const;
00048 virtual QModelIndex parent (const QModelIndex & ) const {return QModelIndex();}
00049 virtual QModelIndex index (int, int column, const QModelIndex & parent=QModelIndex()) const;
00050 virtual bool setData (const QModelIndex & index, const QVariant & value, int role=Qt::EditRole);
00051 virtual Qt::ItemFlags flags (const QModelIndex & ) const;
00052
00053 int removeLayers(QModelIndexList l);
00054 void moveLayersUp(QModelIndexList l);
00055 void moveLayersDown(QModelIndexList l);
00056 void selectLayers(QModelIndexList l);
00057 void selectAllLayers(bool s);
00058 private:
00059 GraphContent * _graph;
00060 };
00061
00062 class LayerPropertiesDelegate : public QItemDelegate
00063 {
00064 Q_OBJECT
00065 public:
00066 LayerPropertiesDelegate(QObject *parent=0) : QItemDelegate(parent) {}
00067
00068 QWidget * createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex &index) const;
00069 void setEditorData(QWidget *editor, const QModelIndex &index) const;
00070 void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
00071 private slots:
00072 void commitWidgetData();
00073 };
00074
00075 class GraphContentLayerProperties : public PropertyWidget, private Ui::GraphContentLayerProperties
00076 {
00077 Q_OBJECT
00078 public:
00079 GraphContentLayerProperties(QWidget * parent=0);
00080 ~GraphContentLayerProperties();
00081
00082 void addGraph(GraphContent * g);
00083 void removeGraph(GraphContent * g);
00084 void reset();
00085 private slots:
00086 void on_currentGraphCombo_currentIndexChanged(int);
00087 void on_saveLayers_clicked();
00088 void on_addLayers_clicked();
00089 void on_removeLayers_clicked();
00090 void on_moveLayerUp_clicked();
00091 void on_moveLayerDown_clicked();
00092 private:
00093 static bool graphLessThan(const GraphContent * l1, const GraphContent * l2);
00094 void setGraphList();
00095 GraphContent * currentGraph() const;
00096
00097 QSet<GraphContent *> _graphSet;
00098 QList<GraphContent *> _graphList;
00099 };
00100
00101 }
00102
00103 #endif // GRAPHCONTENTLAYERPROPERTIES_H