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
45class vtkSelection;
46class vtkTree;
48
49class QMimeData;
50
51class VTKGUISUPPORTQT_EXPORT vtkQtTreeModelAdapter : public vtkQtAbstractModelAdapter
52{
53 Q_OBJECT
54
55public:
56 vtkQtTreeModelAdapter(QObject *parent = 0, vtkTree* tree = 0);
58
60
66
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
119protected:
121 void GenerateVTKIndexToQtModelIndex(vtkIdType vtk_index, QModelIndex qmodel_index);
122
126 QVector<QModelIndex> VTKIndexToQtModelIndex;
127 QHash<QModelIndex, QVariant> IndexToDecoration;
128
129private:
130 vtkQtTreeModelAdapter(const vtkQtTreeModelAdapter &) VTK_DELETE_FUNCTION;
131 void operator=(const vtkQtTreeModelAdapter&) VTK_DELETE_FUNCTION;
132};
133
134#endif
Iterates through adjacent vertices in a graph.
general representation of visualization data
Definition: vtkDataObject.h:65
Superclass for Qt model adapters.
Adapts a tree to a Qt item model.
vtkAdjacentVertexIterator * ChildIterator
Qt::ItemFlags flags(const QModelIndex &index) const
virtual void SetVTKDataObject(vtkDataObject *data)
Set/Get the VTK data object as input to this adapter.
vtkQtTreeModelAdapter(QObject *parent=0, vtkTree *tree=0)
void setTree(vtkTree *t)
Set up the model based on the current tree.
QHash< QModelIndex, QVariant > IndexToDecoration
virtual QItemSelection VTKIndexSelectionToQItemSelection(vtkSelection *vtksel) const
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
virtual vtkDataObject * GetVTKDataObject() const
int rowCount(const QModelIndex &parent=QModelIndex()) const
vtkMTimeType GetVTKDataObjectMTime() const
Get the stored VTK data object modification time of when the adaption to a Qt model was done.
void GenerateVTKIndexToQtModelIndex(vtkIdType vtk_index, QModelIndex qmodel_index)
virtual QMimeData * mimeData(const QModelIndexList &indexes) const
virtual QStringList mimeTypes() const
int columnCount(const QModelIndex &parent=QModelIndex()) const
QModelIndex parent(const QModelIndex &index) const
virtual vtkSelection * QModelIndexListToVTKIndexSelection(const QModelIndexList qmil) const
Selection conversion from VTK land to Qt land.
Qt::DropActions supportedDragActions() const
If drag/drop is enabled in the view, the model will package up the current pedigreeid vtkSelection in...
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
virtual void SetKeyColumnName(const char *name)
virtual void SetColorColumnName(const char *name)
QVector< QModelIndex > VTKIndexToQtModelIndex
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
A node in a selection tree.
Definition: vtkSelection.h:44
A rooted tree data structure.
Definition: vtkTree.h:61
@ orientation
Definition: vtkX3D.h:262
@ value
Definition: vtkX3D.h:220
@ name
Definition: vtkX3D.h:219
@ index
Definition: vtkX3D.h:246
@ data
Definition: vtkX3D.h:315
int vtkIdType
Definition: vtkType.h:287
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248