00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00034 #ifndef __vtkQtTreeModelAdapter_h
00035 #define __vtkQtTreeModelAdapter_h
00036
00037 #include "QVTKWin32Header.h"
00038 #include "vtkType.h"
00039 #include "vtkSelection.h"
00040
00041 #include "vtkQtAbstractModelAdapter.h"
00042 #include <QHash>
00043 #include <QMimeData>
00044 #include <QVector>
00045
00046 class vtkTree;
00047 class vtkAdjacentVertexIterator;
00048
00049 class QVTK_EXPORT vtkQtTreeModelAdapter : public vtkQtAbstractModelAdapter
00050 {
00051 Q_OBJECT
00052
00053 public:
00054 vtkQtTreeModelAdapter(QObject *parent = 0, vtkTree* tree = 0);
00055 ~vtkQtTreeModelAdapter();
00056
00058
00059 virtual void SetVTKDataObject(vtkDataObject *data);
00060 virtual vtkDataObject* GetVTKDataObject() const;
00062
00069 unsigned long GetVTKDataObjectMTime() const;
00070
00072
00073 virtual vtkSelection* QModelIndexListToVTKIndexSelection(
00074 const QModelIndexList qmil) const;
00075 virtual QItemSelection VTKIndexSelectionToQItemSelection(
00076 vtkSelection *vtksel) const;
00078
00079 virtual void SetKeyColumnName(const char* name);
00080
00081 virtual void SetColorColumnName(const char* name);
00082
00084
00085 void setTree(vtkTree* t);
00086 vtkTree* tree() const { return this->Tree; }
00088
00089 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
00090 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
00091 Qt::ItemFlags flags(const QModelIndex &index) const;
00092 QVariant headerData(int section, Qt::Orientation orientation,
00093 int role = Qt::DisplayRole) const;
00094 QModelIndex index(int row, int column,
00095 const QModelIndex &parent = QModelIndex()) const;
00096 QModelIndex parent(const QModelIndex &index) const;
00097 int rowCount(const QModelIndex &parent = QModelIndex()) const;
00098 int columnCount(const QModelIndex &parent = QModelIndex()) const;
00099
00101
00104 Qt::DropActions supportedDragActions() const;
00105 virtual QMimeData * mimeData ( const QModelIndexList & indexes ) const;
00106 virtual QStringList mimeTypes () const ;
00108
00109 protected:
00110 void treeModified();
00111 void GenerateVTKIndexToQtModelIndex(vtkIdType vtk_index, QModelIndex qmodel_index);
00112
00113 vtkTree* Tree;
00114 vtkAdjacentVertexIterator* ChildIterator;
00115 unsigned long TreeMTime;
00116 QVector<QModelIndex> VTKIndexToQtModelIndex;
00117 QHash<QModelIndex, QVariant> IndexToDecoration;
00118
00119 private:
00120 vtkQtTreeModelAdapter(const vtkQtTreeModelAdapter &);
00121 void operator=(const vtkQtTreeModelAdapter&);
00122 };
00123
00124 #endif