VTK
vtkQtTableView.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkQtTableView.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 -------------------------------------------------------------------------*/
37 #ifndef vtkQtTableView_h
38 #define vtkQtTableView_h
39 
40 #include "vtkViewsQtModule.h" // For export macro
41 #include "vtkQtView.h"
42 
43 #include <QPointer> // Needed to hold the view
44 #include "vtkSmartPointer.h" // Needed for member variables
45 
47 class vtkApplyColors;
49 class vtkIdTypeArray;
50 class QItemSelection;
51 class QSortFilterProxyModel;
52 class QTableView;
54 
56 {
57 Q_OBJECT
58 
59 public:
60  static vtkQtTableView *New();
61  vtkTypeMacro(vtkQtTableView, vtkQtView);
62  void PrintSelf(ostream& os, vtkIndent indent);
63 
67  virtual QWidget* GetWidget();
68 
70  void SetShowVerticalHeaders(bool);
71 
73  void SetShowHorizontalHeaders(bool);
74 
75  enum
76  {
77  FIELD_DATA = 0,
78  POINT_DATA = 1,
79  CELL_DATA = 2,
80  VERTEX_DATA = 3,
81  EDGE_DATA = 4,
82  ROW_DATA = 5,
83  };
84 
86 
88  vtkGetMacro(FieldType, int);
89  void SetFieldType(int);
91 
93  void SetEnableDragDrop(bool);
94 
97  void SetSortingEnabled(bool);
98 
100 
103  void SetShowAll(bool);
104  vtkGetMacro(ShowAll, bool);
106 
108 
110  vtkSetStringMacro(ColumnName);
111  vtkGetStringMacro(ColumnName);
113 
114  void SetColumnVisibility(const QString &name, bool status);
115 
118  void SetSplitMultiComponentColumns(bool value);
119 
122  bool GetSplitMultiComponentColumns();
123 
125 
126  void SetSortSelectionToTop(bool value);
127  vtkGetMacro(SortSelectionToTop, bool);
129 
131 
133  void SetApplyRowColors(bool value);
134  vtkGetMacro(ApplyRowColors, bool);
136 
138  virtual void Update();
139 
141 
142  void SetColorArrayName(const char* name);
143  const char* GetColorArrayName();
145 
147 
148  void SetColorByArray(bool vis);
149  bool GetColorByArray();
150  vtkBooleanMacro(ColorByArray, bool);
152 
154  virtual void ApplyViewTheme(vtkViewTheme* theme);
155 
156  enum
157  {
158  SELECT_ITEMS = 0,
160  SELECT_COLUMNS
161  };
162 
164 
169  virtual void SetSelectionBehavior(int type);
170  virtual int GetSelectionBehavior();
172 
178  virtual void GetSelectedItems(vtkIdTypeArray* arr);
179 
180 protected:
181  vtkQtTableView();
182  ~vtkQtTableView();
183 
186 
187 private slots:
188  void slotQtSelectionChanged(const QItemSelection&,const QItemSelection&);
189 
190 private:
191  void SetVTKSelection();
192  unsigned long LastSelectionMTime;
193  unsigned long LastInputMTime;
194  unsigned long LastMTime;
195 
196  vtkSetStringMacro(ColorArrayNameInternal);
197  vtkGetStringMacro(ColorArrayNameInternal);
198 
199  QPointer<QTableView> TableView;
200  vtkQtTableModelAdapter* TableAdapter;
201  QSortFilterProxyModel* TableSorter;
202  int FieldType;
203  bool ShowAll;
204  char* ColumnName;
205  bool InSelectionChanged;
206  bool SortSelectionToTop;
207  bool ApplyRowColors;
208  char* ColorArrayNameInternal;
209 
210  vtkSmartPointer<vtkAddMembershipArray> AddSelectedColumn;
211  vtkSmartPointer<vtkDataObjectToTable> DataObjectToTable;
213 
214  vtkQtTableView(const vtkQtTableView&); // Not implemented.
215  void operator=(const vtkQtTableView&); // Not implemented.
216 
217 };
218 
219 #endif
virtual void ApplyViewTheme(vtkViewTheme *vtkNotUsed(theme))
Definition: vtkView.h:125
Adapts a table to a Qt item model.
static vtkView * New()
virtual void Update()
extract field data as a table
virtual QWidget * GetWidget()=0
#define VTKVIEWSQT_EXPORT
virtual void AddRepresentationInternal(vtkDataRepresentation *vtkNotUsed(rep))
Definition: vtkView.h:203
dynamic, self-adjusting array of vtkIdType
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:47
A VTK view based on a Qt Table view.
a simple class to control print indentation
Definition: vtkIndent.h:38
void PrintSelf(ostream &os, vtkIndent indent)
The superclass for all representations.
apply colors to a data set.
Add an array to the output indicating membership within an input selection.
Superclass for Qt widget-based views.
Definition: vtkQtView.h:30
virtual void RemoveRepresentationInternal(vtkDataRepresentation *vtkNotUsed(rep))
Definition: vtkView.h:204