VTK  9.3.20240418
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 
63 
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 
125 
131 
133 
137  vtkGetMacro(SortSelectionToTop, bool);
139 
141 
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);
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:
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
Add an array to the output indicating membership within an input selection.
apply colors to a data set.
this filter produces a vtkTable from the chosen attribute in the input data object.
The superclass for all representations.
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:108
Adapts a table to a Qt item model.
A VTK view based on a Qt Table view.
void SetColumnVisibility(const QString &name, bool status)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
~vtkQtTableView() override
void SetEnableDragDrop(bool)
Enable drag and drop on this widget.
bool GetColorByArray()
Whether to color vertices.
void SetFieldType(int)
The field type to copy into the output table.
void SetSplitMultiComponentColumns(bool value)
Set whether or not the table view should split multi-component columns into multiple single-component...
void ApplyViewTheme(vtkViewTheme *theme) override
Apply a view theme to this view.
void SetShowVerticalHeaders(bool)
Have the view show/hide its column headers.
void SetSortSelectionToTop(bool value)
Whether or not to sort selections that the view receives to the top.
void AddRepresentationInternal(vtkDataRepresentation *rep) override
bool GetSplitMultiComponentColumns()
Get whether or not the table view splits multi-component columns into multiple single-component colum...
void SetColorByArray(bool vis)
Whether to color vertices.
void SetShowHorizontalHeaders(bool)
Have the view show/hide its row headers.
const char * GetColorArrayName()
The array to use for coloring items in view.
virtual void SetSelectionBehavior(int type)
The selection mode for this view.
virtual void GetSelectedItems(vtkIdTypeArray *arr)
Fills the array with the selected items of the view.
void SetSortingEnabled(bool)
Whether the table allows individual columns to be sorted upon Sorting is enabled by default (turn off...
static vtkQtTableView * New()
virtual int GetSelectionBehavior()
The selection mode for this view.
void SetShowAll(bool)
Whether or not to display all columns from the input table or to use the ColumnName provided.
void Update() override
Updates the view.
QWidget * GetWidget() override
Get the main container of this view (a QWidget).
void SetColorArrayName(const char *name)
The array to use for coloring items in view.
void RemoveRepresentationInternal(vtkDataRepresentation *rep) override
void SetApplyRowColors(bool value)
Whether or not to add an icon to the row header denoting the color of an annotated row.
Superclass for Qt widget-based views.
Definition: vtkQtView.h:27
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:123
@ value
Definition: vtkX3D.h:220
@ type
Definition: vtkX3D.h:516
@ name
Definition: vtkX3D.h:219
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270