VTK
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
51 // The view types.
52 enum {
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
67
71 virtual vtkDataObject* GetVTKDataObject() const = 0;
73
75
79 const QModelIndexList qmil) const = 0;
80 virtual QItemSelection VTKIndexSelectionToQItemSelection(
81 vtkSelection *vtksel) const = 0;
83
90 virtual void SetViewType(int type) { this->ViewType = type; }
91 virtual int GetViewType() { return this->ViewType; }
92
100 virtual void SetKeyColumn(int col) { this->KeyColumn = col; }
101 virtual int GetKeyColumn() { return this->KeyColumn; }
102 virtual void SetKeyColumnName(const char* name) = 0;
103
111 virtual void SetColorColumn(int col) { this->ColorColumn = col; }
112 virtual int GetColorColumn() { return this->ColorColumn; }
113 virtual void SetColorColumnName(const char* name) = 0;
114
120 virtual void SetDataColumnRange(int c1, int c2)
121 { this->DataStartColumn = c1; this->DataEndColumn = c2; }
122
123 // We make the reset() method public because it isn't always possible for
124 // an adapter to know when its input has changed, so it must be callable
125 // by an outside entity.
128 void reset() { QAbstractItemModel::beginResetModel(); QAbstractItemModel::endResetModel();}
129
130 // We make the beginResetModel() and endResetModel() methods public because it
131 // isn't always possible for an adapter to know when its input has changed,
132 // so it must be callable by an outside entity.
133 void beginResetModel() { QAbstractItemModel::beginResetModel(); }
134 void endResetModel() { QAbstractItemModel::endResetModel(); }
135
136
137signals:
139
140protected:
141
147 virtual int ModelColumnToFieldDataColumn(int col) const;
148
154};
155
156#endif
general representation of visualization data
Definition: vtkDataObject.h:65
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
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
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.
A node in a selection tree.
Definition: vtkSelection.h:44
@ type
Definition: vtkX3D.h:516
@ name
Definition: vtkX3D.h:219
@ data
Definition: vtkX3D.h:315