VTK  9.1.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
vtkQtTreeModelAdapter Class Reference

Adapts a tree to a Qt item model. More...

#include <vtkQtTreeModelAdapter.h>

Inheritance diagram for vtkQtTreeModelAdapter:
[legend]
Collaboration diagram for vtkQtTreeModelAdapter:
[legend]

Public Member Functions

 vtkQtTreeModelAdapter (QObject *parent=nullptr, vtkTree *tree=nullptr)
 
 ~vtkQtTreeModelAdapter () override
 
vtkMTimeType GetVTKDataObjectMTime () const
 Get the stored VTK data object modification time of when the adaption to a Qt model was done. More...
 
void SetKeyColumnName (const char *name) override
 
void SetColorColumnName (const char *name) override
 
void setTree (vtkTree *t)
 Set up the model based on the current tree. More...
 
vtkTreetree () const
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const override
 
QModelIndex parent (const QModelIndex &index) const override
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
void SetVTKDataObject (vtkDataObject *data) override
 Set/Get the VTK data object as input to this adapter. More...
 
vtkDataObjectGetVTKDataObject () const override
 Set/Get the VTK data object as input to this adapter. More...
 
vtkSelectionQModelIndexListToVTKIndexSelection (const QModelIndexList qmil) const override
 Selection conversion from VTK land to Qt land. More...
 
QItemSelection VTKIndexSelectionToQItemSelection (vtkSelection *vtksel) const override
 Selection conversion from VTK land to Qt land. More...
 
Qt::DropActions supportedDragActions () const override
 If drag/drop is enabled in the view, the model will package up the current pedigreeid vtkSelection into a QMimeData when items are dragged. More...
 
QMimeData * mimeData (const QModelIndexList &indexes) const override
 If drag/drop is enabled in the view, the model will package up the current pedigreeid vtkSelection into a QMimeData when items are dragged. More...
 
QStringList mimeTypes () const override
 If drag/drop is enabled in the view, the model will package up the current pedigreeid vtkSelection into a QMimeData when items are dragged. More...
 
- Public Member Functions inherited from vtkQtAbstractModelAdapter
 vtkQtAbstractModelAdapter (QObject *p)
 
virtual void SetViewType (int type)
 Set/Get the view type. More...
 
virtual int GetViewType ()
 
virtual void SetKeyColumn (int col)
 Set/Get the key column. More...
 
virtual int GetKeyColumn ()
 
virtual void SetKeyColumnName (const char *name)=0
 
virtual void SetColorColumn (int col)
 Set/Get the column storing the rgba color values for each row. More...
 
virtual int GetColorColumn ()
 
virtual void SetColorColumnName (const char *name)=0
 
virtual void SetDataColumnRange (int c1, int c2)
 Set the range of columns that specify the main data matrix. More...
 
void reset ()
 
void beginResetModel ()
 
void endResetModel ()
 

Protected Member Functions

void treeModified ()
 
void GenerateVTKIndexToQtModelIndex (vtkIdType vtk_index, QModelIndex qmodel_index)
 
- Protected Member Functions inherited from vtkQtAbstractModelAdapter
virtual int ModelColumnToFieldDataColumn (int col) const
 Map a column index in the QAbstractItemModel to a vtkTable column. More...
 

Protected Attributes

vtkTreeTree
 
vtkAdjacentVertexIteratorChildIterator
 
vtkMTimeType TreeMTime
 
QVector< QModelIndex > VTKIndexToQtModelIndex
 
QHash< QModelIndex, QVariant > IndexToDecoration
 
- Protected Attributes inherited from vtkQtAbstractModelAdapter
int ViewType
 
int KeyColumn
 
int ColorColumn
 
int DataStartColumn
 
int DataEndColumn
 

Additional Inherited Members

- Public Types inherited from vtkQtAbstractModelAdapter
enum  { FULL_VIEW , DATA_VIEW }
 
- Signals inherited from vtkQtAbstractModelAdapter
void modelChanged ()
 

Detailed Description

Adapts a tree to a Qt item model.

vtkQtTreeModelAdapter is a QAbstractItemModel with a vtkTree as its underlying data model.

See also
vtkQtAbstractModelAdapter vtkQtTableModelAdapter

Definition at line 48 of file vtkQtTreeModelAdapter.h.

Constructor & Destructor Documentation

◆ vtkQtTreeModelAdapter()

vtkQtTreeModelAdapter::vtkQtTreeModelAdapter ( QObject *  parent = nullptr,
vtkTree tree = nullptr 
)

◆ ~vtkQtTreeModelAdapter()

vtkQtTreeModelAdapter::~vtkQtTreeModelAdapter ( )
override

Member Function Documentation

◆ SetVTKDataObject()

void vtkQtTreeModelAdapter::SetVTKDataObject ( vtkDataObject data)
overridevirtual

Set/Get the VTK data object as input to this adapter.

Implements vtkQtAbstractModelAdapter.

◆ GetVTKDataObject()

vtkDataObject * vtkQtTreeModelAdapter::GetVTKDataObject ( ) const
overridevirtual

Set/Get the VTK data object as input to this adapter.

Implements vtkQtAbstractModelAdapter.

◆ GetVTKDataObjectMTime()

vtkMTimeType vtkQtTreeModelAdapter::GetVTKDataObjectMTime ( ) const

Get the stored VTK data object modification time of when the adaption to a Qt model was done.

This is in general not the same this as the data objects modification time. It is the mod time of the object when it was placed into the Qt model adapter. You can use this mtime as part of the checking to see whether you need to update the adapter by call SetVTKDataObject again. :)

◆ QModelIndexListToVTKIndexSelection()

vtkSelection * vtkQtTreeModelAdapter::QModelIndexListToVTKIndexSelection ( const QModelIndexList  qmil) const
overridevirtual

Selection conversion from VTK land to Qt land.

Implements vtkQtAbstractModelAdapter.

◆ VTKIndexSelectionToQItemSelection()

QItemSelection vtkQtTreeModelAdapter::VTKIndexSelectionToQItemSelection ( vtkSelection vtksel) const
overridevirtual

Selection conversion from VTK land to Qt land.

Implements vtkQtAbstractModelAdapter.

◆ SetKeyColumnName()

void vtkQtTreeModelAdapter::SetKeyColumnName ( const char *  name)
overridevirtual

◆ SetColorColumnName()

void vtkQtTreeModelAdapter::SetColorColumnName ( const char *  name)
overridevirtual

◆ setTree()

void vtkQtTreeModelAdapter::setTree ( vtkTree t)

Set up the model based on the current tree.

◆ tree()

vtkTree * vtkQtTreeModelAdapter::tree ( ) const
inline

Definition at line 90 of file vtkQtTreeModelAdapter.h.

◆ data()

QVariant vtkQtTreeModelAdapter::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
override

◆ setData()

bool vtkQtTreeModelAdapter::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)
override

◆ flags()

Qt::ItemFlags vtkQtTreeModelAdapter::flags ( const QModelIndex &  index) const
override

◆ headerData()

QVariant vtkQtTreeModelAdapter::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
override

◆ index()

QModelIndex vtkQtTreeModelAdapter::index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const
override

◆ parent()

QModelIndex vtkQtTreeModelAdapter::parent ( const QModelIndex &  index) const
override

◆ rowCount()

int vtkQtTreeModelAdapter::rowCount ( const QModelIndex &  parent = QModelIndex()) const
override

◆ columnCount()

int vtkQtTreeModelAdapter::columnCount ( const QModelIndex &  parent = QModelIndex()) const
override

◆ supportedDragActions()

Qt::DropActions vtkQtTreeModelAdapter::supportedDragActions ( ) const
override

If drag/drop is enabled in the view, the model will package up the current pedigreeid vtkSelection into a QMimeData when items are dragged.

Currently only leaves of the tree can be dragged.

◆ mimeData()

QMimeData * vtkQtTreeModelAdapter::mimeData ( const QModelIndexList &  indexes) const
override

If drag/drop is enabled in the view, the model will package up the current pedigreeid vtkSelection into a QMimeData when items are dragged.

Currently only leaves of the tree can be dragged.

◆ mimeTypes()

QStringList vtkQtTreeModelAdapter::mimeTypes ( ) const
override

If drag/drop is enabled in the view, the model will package up the current pedigreeid vtkSelection into a QMimeData when items are dragged.

Currently only leaves of the tree can be dragged.

◆ treeModified()

void vtkQtTreeModelAdapter::treeModified ( )
protected

◆ GenerateVTKIndexToQtModelIndex()

void vtkQtTreeModelAdapter::GenerateVTKIndexToQtModelIndex ( vtkIdType  vtk_index,
QModelIndex  qmodel_index 
)
protected

Member Data Documentation

◆ Tree

vtkTree* vtkQtTreeModelAdapter::Tree
protected

Definition at line 117 of file vtkQtTreeModelAdapter.h.

◆ ChildIterator

vtkAdjacentVertexIterator* vtkQtTreeModelAdapter::ChildIterator
protected

Definition at line 118 of file vtkQtTreeModelAdapter.h.

◆ TreeMTime

vtkMTimeType vtkQtTreeModelAdapter::TreeMTime
protected

Definition at line 119 of file vtkQtTreeModelAdapter.h.

◆ VTKIndexToQtModelIndex

QVector<QModelIndex> vtkQtTreeModelAdapter::VTKIndexToQtModelIndex
protected

Definition at line 120 of file vtkQtTreeModelAdapter.h.

◆ IndexToDecoration

QHash<QModelIndex, QVariant> vtkQtTreeModelAdapter::IndexToDecoration
protected

Definition at line 121 of file vtkQtTreeModelAdapter.h.


The documentation for this class was generated from the following file: