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 -------------------------------------------------------------------------*/
34 #ifndef vtkQtAbstractModelAdapter_h
35 #define vtkQtAbstractModelAdapter_h
36 
37 #include "vtkGUISupportQtModule.h" // For export macro
38 #include "QVTKWin32Header.h"
39 #include <QAbstractItemModel>
40 #include <QItemSelection>
41 
42 class vtkDataObject;
43 class vtkSelection;
44 class QItemSelection;
45 class VTKGUISUPPORTQT_EXPORT vtkQtAbstractModelAdapter : public QAbstractItemModel
46 {
47  Q_OBJECT
48 
49 public:
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 
68  virtual void SetVTKDataObject(vtkDataObject *data) = 0;
69  virtual vtkDataObject* GetVTKDataObject() const = 0;
71 
73 
74  virtual vtkSelection* QModelIndexListToVTKIndexSelection(
75  const QModelIndexList qmil) const = 0;
76  virtual QItemSelection VTKIndexSelectionToQItemSelection(
77  vtkSelection *vtksel) const = 0;
79 
81 
84  virtual void SetViewType(int type) { this->ViewType = type; }
85  virtual int GetViewType() { return this->ViewType; }
87 
89 
92  virtual void SetKeyColumn(int col) { this->KeyColumn = col; }
93  virtual int GetKeyColumn() { return this->KeyColumn; }
94  virtual void SetKeyColumnName(const char* name) = 0;
96 
98 
102  virtual void SetColorColumn(int col) { this->ColorColumn = col; }
103  virtual int GetColorColumn() { return this->ColorColumn; }
104  virtual void SetColorColumnName(const char* name) = 0;
106 
108 
111  virtual void SetDataColumnRange(int c1, int c2)
112  { this->DataStartColumn = c1; this->DataEndColumn = c2; }
114 
115  // We make the reset() method public because it isn't always possible for
116  // an adapter to know when its input has changed, so it must be callable
117  // by an outside entity.
120  void reset() { QAbstractItemModel::beginResetModel(); QAbstractItemModel::endResetModel();}
121 
122  // We make the beginResetModel() and endResetModel() methods public because it
123  // isn't always possible for an adapter to know when its input has changed,
124  // so it must be callable by an outside entity.
125  void beginResetModel() { QAbstractItemModel::beginResetModel(); }
126  void endResetModel() { QAbstractItemModel::endResetModel(); }
127 
128 
129 signals:
130  void modelChanged();
131 
132 protected:
133 
137  virtual int ModelColumnToFieldDataColumn(int col) const;
138 
139  int ViewType;
144 };
145 
146 #endif
A node in a selection tree. Used to store selection results.
Definition: vtkSelection.h:44
virtual void SetKeyColumn(int col)
virtual void SetDataColumnRange(int c1, int c2)
Superclass for Qt model adapters.
general representation of visualization data
Definition: vtkDataObject.h:64
virtual void SetColorColumn(int col)
virtual void SetViewType(int type)