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 <QAbstractItemModel>
39 #include <QItemSelection> // Needed for selection methods
40 
41 class vtkDataObject;
42 class vtkSelection;
43 
44 class VTKGUISUPPORTQT_EXPORT vtkQtAbstractModelAdapter : public QAbstractItemModel
45 {
46  Q_OBJECT
47 
48 public:
49 
50  // The view types.
51  enum {
53  DATA_VIEW
54  };
55 
57  QAbstractItemModel(p),
58  ViewType(FULL_VIEW),
59  KeyColumn(-1),
60  ColorColumn(-1),
61  DataStartColumn(-1),
62  DataEndColumn(-1)
63  { }
64 
66 
67  virtual void SetVTKDataObject(vtkDataObject *data) = 0;
68  virtual vtkDataObject* GetVTKDataObject() const = 0;
70 
72 
73  virtual vtkSelection* QModelIndexListToVTKIndexSelection(
74  const QModelIndexList qmil) const = 0;
75  virtual QItemSelection VTKIndexSelectionToQItemSelection(
76  vtkSelection *vtksel) const = 0;
78 
80 
83  virtual void SetViewType(int type) { this->ViewType = type; }
84  virtual int GetViewType() { return this->ViewType; }
86 
88 
91  virtual void SetKeyColumn(int col) { this->KeyColumn = col; }
92  virtual int GetKeyColumn() { return this->KeyColumn; }
93  virtual void SetKeyColumnName(const char* name) = 0;
95 
97 
101  virtual void SetColorColumn(int col) { this->ColorColumn = col; }
102  virtual int GetColorColumn() { return this->ColorColumn; }
103  virtual void SetColorColumnName(const char* name) = 0;
105 
107 
110  virtual void SetDataColumnRange(int c1, int c2)
111  { this->DataStartColumn = c1; this->DataEndColumn = c2; }
113 
114  // We make the reset() method public because it isn't always possible for
115  // an adapter to know when its input has changed, so it must be callable
116  // by an outside entity.
119  void reset() { QAbstractItemModel::beginResetModel(); QAbstractItemModel::endResetModel();}
120 
121  // We make the beginResetModel() and endResetModel() methods public because it
122  // isn't always possible for an adapter to know when its input has changed,
123  // so it must be callable by an outside entity.
124  void beginResetModel() { QAbstractItemModel::beginResetModel(); }
125  void endResetModel() { QAbstractItemModel::endResetModel(); }
126 
127 
128 signals:
129  void modelChanged();
130 
131 protected:
132 
136  virtual int ModelColumnToFieldDataColumn(int col) const;
137 
138  int ViewType;
143 };
144 
145 #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)
#define VTKGUISUPPORTQT_EXPORT
Superclass for Qt model adapters.
general representation of visualization data
Definition: vtkDataObject.h:64
virtual void SetColorColumn(int col)
virtual void SetViewType(int type)