VTK  9.2.6
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 "vtkQtView.h"
42 #include "vtkViewsQtModule.h" // For export macro
43 
44 #include "vtkSmartPointer.h" // Needed for member variables
45 #include <QPointer> // Needed to hold the view
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 
77 
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 
139 
145 
147 
151  vtkGetMacro(SortSelectionToTop, bool);
153 
155 
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);
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:
223  ~vtkQtTableView() override;
224 
227 
228 private Q_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 #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:49
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:58
@ value
Definition: vtkX3D.h:226
@ type
Definition: vtkX3D.h:522
@ name
Definition: vtkX3D.h:225
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287