VTK  9.3.1
vtkQtTableView.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
22 #ifndef vtkQtTableView_h
23 #define vtkQtTableView_h
24 
25 #include "vtkQtView.h"
26 #include "vtkViewsQtModule.h" // For export macro
27 
28 #include "vtkSmartPointer.h" // Needed for member variables
29 #include <QPointer> // Needed to hold the view
30 
31 class QItemSelection;
32 class QSortFilterProxyModel;
33 class QTableView;
34 
35 VTK_ABI_NAMESPACE_BEGIN
37 class vtkApplyColors;
39 class vtkIdTypeArray;
41 
42 class VTKVIEWSQT_EXPORT vtkQtTableView : public vtkQtView
43 {
44  Q_OBJECT
45 
46 public:
47  static vtkQtTableView* New();
48  vtkTypeMacro(vtkQtTableView, vtkQtView);
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
57  QWidget* GetWidget() override;
58 
62  void SetShowVerticalHeaders(bool);
63 
67  void SetShowHorizontalHeaders(bool);
68 
69  enum
70  {
71  FIELD_DATA = 0,
72  POINT_DATA = 1,
73  CELL_DATA = 2,
74  VERTEX_DATA = 3,
75  EDGE_DATA = 4,
76  ROW_DATA = 5,
77  };
78 
80 
84  vtkGetMacro(FieldType, int);
85  void SetFieldType(int);
87 
91  void SetEnableDragDrop(bool);
92 
97  void SetSortingEnabled(bool);
98 
100 
105  void SetShowAll(bool);
106  vtkGetMacro(ShowAll, bool);
108 
110 
114  vtkSetStringMacro(ColumnName);
115  vtkGetStringMacro(ColumnName);
117 
118  void SetColumnVisibility(const QString& name, bool status);
119 
124  void SetSplitMultiComponentColumns(bool value);
125 
130  bool GetSplitMultiComponentColumns();
131 
133 
136  void SetSortSelectionToTop(bool value);
137  vtkGetMacro(SortSelectionToTop, bool);
139 
141 
145  void SetApplyRowColors(bool value);
146  vtkGetMacro(ApplyRowColors, bool);
148 
152  void Update() override;
153 
155 
158  void SetColorArrayName(const char* name);
159  const char* GetColorArrayName();
161 
163 
166  void SetColorByArray(bool vis);
167  bool GetColorByArray();
168  vtkBooleanMacro(ColorByArray, bool);
170 
174  void ApplyViewTheme(vtkViewTheme* theme) override;
175 
176  enum
177  {
178  SELECT_ITEMS = 0,
180  SELECT_COLUMNS
181  };
182 
184 
193  virtual void SetSelectionBehavior(int type);
194  virtual int GetSelectionBehavior();
196 
205  virtual void GetSelectedItems(vtkIdTypeArray* arr);
206 
207 protected:
208  vtkQtTableView();
209  ~vtkQtTableView() override;
210 
213 
214 private Q_SLOTS:
215  void slotQtSelectionChanged(const QItemSelection&, const QItemSelection&);
216 
217 private: // NOLINT(readability-redundant-access-specifiers)
218  void SetVTKSelection();
219  vtkMTimeType LastSelectionMTime;
220  vtkMTimeType LastInputMTime;
221  vtkMTimeType LastMTime;
222 
223  vtkSetStringMacro(ColorArrayNameInternal);
224  vtkGetStringMacro(ColorArrayNameInternal);
225 
226  QPointer<QTableView> TableView;
227  vtkQtTableModelAdapter* TableAdapter;
228  QSortFilterProxyModel* TableSorter;
229  int FieldType;
230  bool ShowAll;
231  char* ColumnName;
232  bool InSelectionChanged;
233  bool SortSelectionToTop;
234  bool ApplyRowColors;
235  char* ColorArrayNameInternal;
236 
237  vtkSmartPointer<vtkAddMembershipArray> AddSelectedColumn;
240 
241  vtkQtTableView(const vtkQtTableView&) = delete;
242  void operator=(const vtkQtTableView&) = delete;
243 };
244 
245 VTK_ABI_NAMESPACE_END
246 #endif
virtual void ApplyViewTheme(vtkViewTheme *vtkNotUsed(theme))
Apply a theme to the view.
Definition: vtkView.h:141
Adapts a table to a Qt item model.
static vtkView * New()
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
virtual void Update()
Update the view.
this filter produces a vtkTable from the chosen attribute in the input data object.
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:219
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:33
A VTK view based on a Qt Table view.
a simple class to control print indentation
Definition: vtkIndent.h:28
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:24
virtual void RemoveRepresentationInternal(vtkDataRepresentation *vtkNotUsed(rep))
Meant for use by subclasses and vtkRepresentation subclasses.
Definition: vtkView.h:220