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 -------------------------------------------------------------------------*/
38 #ifndef vtkQtTableView_h
39 #define vtkQtTableView_h
40 
41 #include "vtkViewsQtModule.h" // For export macro
42 #include "vtkQtView.h"
43 
44 #include <QPointer> // Needed to hold the view
45 #include "vtkSmartPointer.h" // Needed for member variables
46 
48 class vtkApplyColors;
50 class vtkIdTypeArray;
51 class QItemSelection;
52 class QSortFilterProxyModel;
53 class QTableView;
55 
56 class VTKVIEWSQT_EXPORT vtkQtTableView : public vtkQtView
57 {
58 Q_OBJECT
59 
60 public:
61  static vtkQtTableView *New();
62  vtkTypeMacro(vtkQtTableView, vtkQtView);
63  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
71  QWidget* GetWidget() override;
72 
76  void SetShowVerticalHeaders(bool);
77 
81  void SetShowHorizontalHeaders(bool);
82 
83  enum
84  {
85  FIELD_DATA = 0,
86  POINT_DATA = 1,
87  CELL_DATA = 2,
88  VERTEX_DATA = 3,
89  EDGE_DATA = 4,
90  ROW_DATA = 5,
91  };
92 
94 
98  vtkGetMacro(FieldType, int);
99  void SetFieldType(int);
101 
105  void SetEnableDragDrop(bool);
106 
111  void SetSortingEnabled(bool);
112 
114 
119  void SetShowAll(bool);
120  vtkGetMacro(ShowAll, bool);
122 
124 
128  vtkSetStringMacro(ColumnName);
129  vtkGetStringMacro(ColumnName);
131 
132  void SetColumnVisibility(const QString &name, bool status);
133 
138  void SetSplitMultiComponentColumns(bool value);
139 
144  bool GetSplitMultiComponentColumns();
145 
147 
150  void SetSortSelectionToTop(bool value);
151  vtkGetMacro(SortSelectionToTop, bool);
153 
155 
159  void SetApplyRowColors(bool value);
160  vtkGetMacro(ApplyRowColors, bool);
162 
166  void Update() override;
167 
169 
172  void SetColorArrayName(const char* name);
173  const char* GetColorArrayName();
175 
177 
180  void SetColorByArray(bool vis);
181  bool GetColorByArray();
182  vtkBooleanMacro(ColorByArray, bool);
184 
188  void ApplyViewTheme(vtkViewTheme* theme) override;
189 
190  enum
191  {
192  SELECT_ITEMS = 0,
194  SELECT_COLUMNS
195  };
196 
198 
207  virtual void SetSelectionBehavior(int type);
208  virtual int GetSelectionBehavior();
210 
219  virtual void GetSelectedItems(vtkIdTypeArray* arr);
220 
221 protected:
222  vtkQtTableView();
223  ~vtkQtTableView() override;
224 
227 
228 private slots:
229  void slotQtSelectionChanged(const QItemSelection&,const QItemSelection&);
230 
231 private:
232  void SetVTKSelection();
233  vtkMTimeType LastSelectionMTime;
234  vtkMTimeType LastInputMTime;
235  vtkMTimeType LastMTime;
236 
237  vtkSetStringMacro(ColorArrayNameInternal);
238  vtkGetStringMacro(ColorArrayNameInternal);
239 
240  QPointer<QTableView> TableView;
241  vtkQtTableModelAdapter* TableAdapter;
242  QSortFilterProxyModel* TableSorter;
243  int FieldType;
244  bool ShowAll;
245  char* ColumnName;
246  bool InSelectionChanged;
247  bool SortSelectionToTop;
248  bool ApplyRowColors;
249  char* ColorArrayNameInternal;
250 
251  vtkSmartPointer<vtkAddMembershipArray> AddSelectedColumn;
252  vtkSmartPointer<vtkDataObjectToTable> DataObjectToTable;
254 
255  vtkQtTableView(const vtkQtTableView&) = delete;
256  void operator=(const vtkQtTableView&) = delete;
257 
258 };
259 
260 #endif
virtual void ApplyViewTheme(vtkViewTheme *vtkNotUsed(theme))
Apply a theme to the view.
Definition: vtkView.h:153
Adapts a table to a Qt item model.
static vtkView * New()
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
virtual void Update()
Update the view.
extract field data as a table
virtual QWidget * GetWidget()=0
Get the main container of this view (a QWidget).
virtual void AddRepresentationInternal(vtkDataRepresentation *vtkNotUsed(rep))
Subclass "hooks" for notifying subclasses of vtkView when representations are added or removed...
Definition: vtkView.h:237
dynamic, self-adjusting array of vtkIdType
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:48
A VTK view based on a Qt Table view.
a simple class to control print indentation
Definition: vtkIndent.h:39
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:31
virtual void RemoveRepresentationInternal(vtkDataRepresentation *vtkNotUsed(rep))
Meant for use by subclasses and vtkRepresentation subclasses.
Definition: vtkView.h:238