VTK  9.2.6
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-------------------------------------------------------------------------*/
34
35#ifndef vtkQtTreeModelAdapter_h
36#define vtkQtTreeModelAdapter_h
37
38#include "vtkGUISupportQtModule.h" // For export macro
39
41#include "vtkType.h" // Needed for vtkIdType
42#include <QHash> // Needed for the decoration map
43#include <QVector> // Needed for the index map
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 = nullptr, vtkTree* tree = nullptr);
58
60
66
76
78
81 vtkSelection* QModelIndexListToVTKIndexSelection(const QModelIndexList qmil) const override;
82 QItemSelection VTKIndexSelectionToQItemSelection(vtkSelection* vtksel) const override;
84
85 void SetKeyColumnName(const char* name) override;
86
87 void SetColorColumnName(const char* name) override;
88
92 void setTree(vtkTree* t);
93 vtkTree* tree() const { return this->Tree; }
94
95 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
96 bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
97 Qt::ItemFlags flags(const QModelIndex& index) const override;
98 QVariant headerData(
99 int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
100 QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
101 QModelIndex parent(const QModelIndex& index) const override;
102 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
103 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
104
106
111 Qt::DropActions supportedDragActions() const override;
112 QMimeData* mimeData(const QModelIndexList& indexes) const override;
113 QStringList mimeTypes() const override;
115
116protected:
118 void GenerateVTKIndexToQtModelIndex(vtkIdType vtk_index, QModelIndex qmodel_index);
119
123 QVector<QModelIndex> VTKIndexToQtModelIndex;
124 QHash<QModelIndex, QVariant> IndexToDecoration;
125
126private:
128 void operator=(const vtkQtTreeModelAdapter&) = delete;
129};
130
131#endif
132// VTK-HeaderTest-Exclude: vtkQtTreeModelAdapter.h
Iterates through adjacent vertices in a graph.
general representation of visualization data
void SetVTKDataObject(vtkDataObject *data) override
Set/Get the VTK data object as input to this adapter.
vtkAdjacentVertexIterator * ChildIterator
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
void setTree(vtkTree *t)
Set up the model based on the current tree.
QHash< QModelIndex, QVariant > IndexToDecoration
int rowCount(const QModelIndex &parent=QModelIndex()) const override
vtkSelection * QModelIndexListToVTKIndexSelection(const QModelIndexList qmil) const override
Selection conversion from VTK land to Qt land.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
void SetColorColumnName(const char *name) override
Qt::DropActions supportedDragActions() const override
If drag/drop is enabled in the view, the model will package up the current pedigreeid vtkSelection in...
vtkMTimeType GetVTKDataObjectMTime() const
Get the stored VTK data object modification time of when the adaption to a Qt model was done.
vtkDataObject * GetVTKDataObject() const override
Set/Get the VTK data object as input to this adapter.
void GenerateVTKIndexToQtModelIndex(vtkIdType vtk_index, QModelIndex qmodel_index)
QMimeData * mimeData(const QModelIndexList &indexes) const override
If drag/drop is enabled in the view, the model will package up the current pedigreeid vtkSelection in...
QModelIndex parent(const QModelIndex &index) const override
Qt::ItemFlags flags(const QModelIndex &index) const override
QStringList mimeTypes() const override
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) override
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
int columnCount(const QModelIndex &parent=QModelIndex()) const override
QItemSelection VTKIndexSelectionToQItemSelection(vtkSelection *vtksel) const override
Selection conversion from VTK land to Qt land.
QVector< QModelIndex > VTKIndexToQtModelIndex
vtkQtTreeModelAdapter(QObject *parent=nullptr, vtkTree *tree=nullptr)
void SetKeyColumnName(const char *name) override
~vtkQtTreeModelAdapter() override
data object that represents a "selection" in VTK.
A rooted tree data structure.
Definition vtkTree.h:61
int vtkIdType
Definition vtkType.h:332
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:287