VTK  9.1.0
vtkQtAbstractModelAdapter.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkQtAbstractModelAdapter.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 vtkQtAbstractModelAdapter_h
36#define vtkQtAbstractModelAdapter_h
37
38#include "vtkGUISupportQtModule.h" // For export macro
39#include <QAbstractItemModel>
40#include <QItemSelection> // Needed for selection methods
41
42class vtkDataObject;
43class vtkSelection;
44
45class VTKGUISUPPORTQT_EXPORT vtkQtAbstractModelAdapter : public QAbstractItemModel
46{
47 Q_OBJECT
48
49public:
50 // The view types.
51 enum
52 {
54 DATA_VIEW
55 };
56
58 : QAbstractItemModel(p)
59 , ViewType(FULL_VIEW)
60 , KeyColumn(-1)
61 , ColorColumn(-1)
62 , DataStartColumn(-1)
63 , DataEndColumn(-1)
64 {
65 }
66
68
71 virtual void SetVTKDataObject(vtkDataObject* data) = 0;
72 virtual vtkDataObject* GetVTKDataObject() const = 0;
74
76
79 virtual vtkSelection* QModelIndexListToVTKIndexSelection(const QModelIndexList qmil) const = 0;
80 virtual QItemSelection VTKIndexSelectionToQItemSelection(vtkSelection* vtksel) const = 0;
82
89 virtual void SetViewType(int type) { this->ViewType = type; }
90 virtual int GetViewType() { return this->ViewType; }
91
99 virtual void SetKeyColumn(int col) { this->KeyColumn = col; }
100 virtual int GetKeyColumn() { return this->KeyColumn; }
101 virtual void SetKeyColumnName(const char* name) = 0;
102
110 virtual void SetColorColumn(int col) { this->ColorColumn = col; }
111 virtual int GetColorColumn() { return this->ColorColumn; }
112 virtual void SetColorColumnName(const char* name) = 0;
113
119 virtual void SetDataColumnRange(int c1, int c2)
120 {
121 this->DataStartColumn = c1;
122 this->DataEndColumn = c2;
123 }
124
125 // We make the reset() method public because it isn't always possible for
126 // an adapter to know when its input has changed, so it must be callable
127 // by an outside entity.
130 void reset()
131 {
132 QAbstractItemModel::beginResetModel();
133 QAbstractItemModel::endResetModel();
134 }
135
136 // We make the beginResetModel() and endResetModel() methods public because it
137 // isn't always possible for an adapter to know when its input has changed,
138 // so it must be callable by an outside entity.
139 void beginResetModel() { QAbstractItemModel::beginResetModel(); }
140 void endResetModel() { QAbstractItemModel::endResetModel(); }
141
142Q_SIGNALS:
144
145protected:
151 virtual int ModelColumnToFieldDataColumn(int col) const;
152
158};
159
160#endif
161// VTK-HeaderTest-Exclude: vtkQtAbstractModelAdapter.h
general representation of visualization data
Superclass for Qt model adapters.
virtual int ModelColumnToFieldDataColumn(int col) const
Map a column index in the QAbstractItemModel to a vtkTable column.
virtual void SetViewType(int type)
Set/Get the view type.
virtual void SetColorColumn(int col)
Set/Get the column storing the rgba color values for each row.
virtual void SetVTKDataObject(vtkDataObject *data)=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.
virtual void SetKeyColumnName(const char *name)=0
virtual void SetKeyColumn(int col)
Set/Get the key column.
virtual vtkSelection * QModelIndexListToVTKIndexSelection(const QModelIndexList qmil) const =0
Selection conversion from VTK land to Qt land.
virtual vtkDataObject * GetVTKDataObject() const =0
Set/Get the VTK data object as input to this adapter.
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.
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:163