VTK  9.2.5
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 -------------------------------------------------------------------------*/
67 #ifndef vtkQtTableView_h
68 #define vtkQtTableView_h
69 
70 #include "vtkQtView.h"
71 #include "vtkViewsQtModule.h" // For export macro
72 
73 #include "vtkSmartPointer.h" // Needed for member variables
74 #include <QPointer> // Needed to hold the view
75 
77 class vtkApplyColors;
79 class vtkIdTypeArray;
80 class QItemSelection;
81 class QSortFilterProxyModel;
82 class QTableView;
84 
85 class VTKVIEWSQT_EXPORT vtkQtTableView : public vtkQtView
86 {
87  Q_OBJECT
88 
89 public:
90  static vtkQtTableView* New();
91  vtkTypeMacro(vtkQtTableView, vtkQtView);
92  void PrintSelf(ostream& os, vtkIndent indent) override;
93 
100  QWidget* GetWidget() override;
101 
106 
111 
112  enum
113  {
114  FIELD_DATA = 0,
115  POINT_DATA = 1,
116  CELL_DATA = 2,
117  VERTEX_DATA = 3,
118  EDGE_DATA = 4,
119  ROW_DATA = 5,
120  };
121 
123 
127  vtkGetMacro(FieldType, int);
128  void SetFieldType(int);
130 
134  void SetEnableDragDrop(bool);
135 
140  void SetSortingEnabled(bool);
141 
143 
148  void SetShowAll(bool);
149  vtkGetMacro(ShowAll, bool);
151 
153 
157  vtkSetStringMacro(ColumnName);
158  vtkGetStringMacro(ColumnName);
160 
161  void SetColumnVisibility(const QString& name, bool status);
162 
168 
174 
176 
180  vtkGetMacro(SortSelectionToTop, bool);
182 
184 
189  vtkGetMacro(ApplyRowColors, bool);
191 
195  void Update() override;
196 
198 
201  void SetColorArrayName(const char* name);
202  const char* GetColorArrayName();
204 
206 
209  void SetColorByArray(bool vis);
211  vtkBooleanMacro(ColorByArray, bool);
213 
217  void ApplyViewTheme(vtkViewTheme* theme) override;
218 
219  enum
220  {
221  SELECT_ITEMS = 0,
223  SELECT_COLUMNS
224  };
225 
227 
236  virtual void SetSelectionBehavior(int type);
237  virtual int GetSelectionBehavior();
239 
248  virtual void GetSelectedItems(vtkIdTypeArray* arr);
249 
250 protected:
252  ~vtkQtTableView() override;
253 
256 
257 private Q_SLOTS:
258  void slotQtSelectionChanged(const QItemSelection&, const QItemSelection&);
259 
260 private:
261  void SetVTKSelection();
262  vtkMTimeType LastSelectionMTime;
263  vtkMTimeType LastInputMTime;
264  vtkMTimeType LastMTime;
265 
266  vtkSetStringMacro(ColorArrayNameInternal);
267  vtkGetStringMacro(ColorArrayNameInternal);
268 
269  QPointer<QTableView> TableView;
270  vtkQtTableModelAdapter* TableAdapter;
271  QSortFilterProxyModel* TableSorter;
272  int FieldType;
273  bool ShowAll;
274  char* ColumnName;
275  bool InSelectionChanged;
276  bool SortSelectionToTop;
277  bool ApplyRowColors;
278  char* ColorArrayNameInternal;
279 
280  vtkSmartPointer<vtkAddMembershipArray> AddSelectedColumn;
281  vtkSmartPointer<vtkDataObjectToTable> DataObjectToTable;
283 
284  vtkQtTableView(const vtkQtTableView&) = delete;
285  void operator=(const vtkQtTableView&) = delete;
286 };
287 
288 #endif
Add an array to the output indicating membership within an input selection.
apply colors to a data set.
extract field data as a table
The superclass for all representations.
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:119
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:34
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:138
@ value
Definition: vtkX3D.h:226
@ type
Definition: vtkX3D.h:522
@ name
Definition: vtkX3D.h:225
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287