VTK  9.4.20250114
vtkQtTreeModelAdapter.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3// SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
19#ifndef vtkQtTreeModelAdapter_h
20#define vtkQtTreeModelAdapter_h
21
22#include "vtkGUISupportQtModule.h" // For export macro
23
25#include "vtkType.h" // Needed for vtkIdType
26#include <QHash> // Needed for the decoration map
27#include <QVector> // Needed for the index map
28
29class QMimeData;
30
31VTK_ABI_NAMESPACE_BEGIN
32class vtkSelection;
33class vtkTree;
35
36class VTKGUISUPPORTQT_EXPORT vtkQtTreeModelAdapter : public vtkQtAbstractModelAdapter
37{
38 Q_OBJECT
39
40public:
41 vtkQtTreeModelAdapter(QObject* parent = nullptr, vtkTree* tree = nullptr);
43
45
48 void SetVTKDataObject(vtkDataObject* data) override;
51
61
63
66 vtkSelection* QModelIndexListToVTKIndexSelection(QModelIndexList qmil) const override;
67 QItemSelection VTKIndexSelectionToQItemSelection(vtkSelection* vtksel) const override;
69
70 void SetKeyColumnName(const char* name) override;
71
72 void SetColorColumnName(const char* name) override;
73
77 void setTree(vtkTree* t);
78 vtkTree* tree() const { return this->Tree; }
79
80 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
81 bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
82 Qt::ItemFlags flags(const QModelIndex& index) const override;
83 QVariant headerData(
84 int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
85 QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
86 QModelIndex parent(const QModelIndex& index) const override;
87 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
88 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
89
91
96 Qt::DropActions supportedDragActions() const override;
97 QMimeData* mimeData(const QModelIndexList& indexes) const override;
98 QStringList mimeTypes() const override;
100
101protected:
103 void GenerateVTKIndexToQtModelIndex(vtkIdType vtk_index, QModelIndex qmodel_index);
104
108 QVector<QModelIndex> VTKIndexToQtModelIndex;
109 QHash<QModelIndex, QVariant> IndexToDecoration;
110
111private:
113 void operator=(const vtkQtTreeModelAdapter&) = delete;
114};
115
116VTK_ABI_NAMESPACE_END
117#endif
118// VTK-HeaderTest-Exclude: vtkQtTreeModelAdapter.h
Iterates through adjacent vertices in a graph.
general representation of visualization data
Superclass for Qt model adapters.
Adapts a tree to a Qt item model.
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
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.
vtkSelection * QModelIndexListToVTKIndexSelection(QModelIndexList qmil) const override
Selection conversion from VTK land to Qt land.
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:155
int vtkIdType
Definition vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270