VTK
vtkQtTreeModelAdapter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkQtTreeModelAdapter.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2008 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
35 #ifndef vtkQtTreeModelAdapter_h
36 #define vtkQtTreeModelAdapter_h
37 
38 #include "vtkGUISupportQtModule.h" // For export macro
39 
41 #include <QHash> // Needed for the decoration map
42 #include <QVector> // Needed for the index map
43 #include "vtkType.h" // Needed for vtkIdType
44 
45 class vtkSelection;
46 class vtkTree;
48 
49 class QMimeData;
50 
51 class VTKGUISUPPORTQT_EXPORT vtkQtTreeModelAdapter : public vtkQtAbstractModelAdapter
52 {
53  Q_OBJECT
54 
55 public:
56  vtkQtTreeModelAdapter(QObject *parent = 0, vtkTree* tree = 0);
58 
60 
63  virtual void SetVTKDataObject(vtkDataObject *data);
64  virtual vtkDataObject* GetVTKDataObject() const;
66 
75  vtkMTimeType GetVTKDataObjectMTime() const;
76 
78 
82  const QModelIndexList qmil) const;
83  virtual QItemSelection VTKIndexSelectionToQItemSelection(
84  vtkSelection *vtksel) const;
86 
87  virtual void SetKeyColumnName(const char* name);
88 
89  virtual void SetColorColumnName(const char* name);
90 
94  void setTree(vtkTree* t);
95  vtkTree* tree() const { return this->Tree; }
96 
97  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
98  bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
99  Qt::ItemFlags flags(const QModelIndex &index) const;
100  QVariant headerData(int section, Qt::Orientation orientation,
101  int role = Qt::DisplayRole) const;
102  QModelIndex index(int row, int column,
103  const QModelIndex &parent = QModelIndex()) const;
104  QModelIndex parent(const QModelIndex &index) const;
105  int rowCount(const QModelIndex &parent = QModelIndex()) const;
106  int columnCount(const QModelIndex &parent = QModelIndex()) const;
107 
109 
114  Qt::DropActions supportedDragActions() const;
115  virtual QMimeData * mimeData ( const QModelIndexList & indexes ) const;
116  virtual QStringList mimeTypes () const ;
118 
119 protected:
120  void treeModified();
121  void GenerateVTKIndexToQtModelIndex(vtkIdType vtk_index, QModelIndex qmodel_index);
122 
126  QVector<QModelIndex> VTKIndexToQtModelIndex;
127  QHash<QModelIndex, QVariant> IndexToDecoration;
128 
129 private:
130  vtkQtTreeModelAdapter(const vtkQtTreeModelAdapter &) VTK_DELETE_FUNCTION;
131  void operator=(const vtkQtTreeModelAdapter&) VTK_DELETE_FUNCTION;
132 };
133 
134 #endif
QHash< QModelIndex, QVariant > IndexToDecoration
vtkAdjacentVertexIterator * ChildIterator
Adapts a tree to a Qt item model.
QVector< QModelIndex > VTKIndexToQtModelIndex
Iterates through adjacent vertices in a graph.
A node in a selection tree.
Definition: vtkSelection.h:43
int vtkIdType
Definition: vtkType.h:287
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
virtual vtkSelection * QModelIndexListToVTKIndexSelection(const QModelIndexList qmil) const =0
Selection conversion from VTK land to Qt land.
virtual void SetColorColumnName(const char *name)=0
virtual vtkDataObject * GetVTKDataObject() const =0
Set/Get the VTK data object as input to this adapter.
virtual QItemSelection VTKIndexSelectionToQItemSelection(vtkSelection *vtksel) const =0
Selection conversion from VTK land to Qt land.
Superclass for Qt model adapters.
virtual void SetKeyColumnName(const char *name)=0
virtual void SetVTKDataObject(vtkDataObject *data)=0
Set/Get the VTK data object as input to this adapter.
A rooted tree data structure.
Definition: vtkTree.h:60
general representation of visualization data
Definition: vtkDataObject.h:64