VTK  9.1.0
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 -------------------------------------------------------------------------*/
61 #ifndef vtkQtTableView_h
62 #define vtkQtTableView_h
63 
64 #include "vtkQtView.h"
65 #include "vtkViewsQtModule.h" // For export macro
66 
67 #include "vtkSmartPointer.h" // Needed for member variables
68 #include <QPointer> // Needed to hold the view
69 
71 class vtkApplyColors;
73 class vtkIdTypeArray;
74 class QItemSelection;
75 class QSortFilterProxyModel;
76 class QTableView;
78 
79 class VTKVIEWSQT_EXPORT vtkQtTableView : public vtkQtView
80 {
81  Q_OBJECT
82 
83 public:
84  static vtkQtTableView* New();
85  vtkTypeMacro(vtkQtTableView, vtkQtView);
86  void PrintSelf(ostream& os, vtkIndent indent) override;
87 
94  QWidget* GetWidget() override;
95 
100 
105 
106  enum
107  {
108  FIELD_DATA = 0,
109  POINT_DATA = 1,
110  CELL_DATA = 2,
111  VERTEX_DATA = 3,
112  EDGE_DATA = 4,
113  ROW_DATA = 5,
114  };
115 
117 
121  vtkGetMacro(FieldType, int);
122  void SetFieldType(int);
124 
128  void SetEnableDragDrop(bool);
129 
134  void SetSortingEnabled(bool);
135 
137 
142  void SetShowAll(bool);
143  vtkGetMacro(ShowAll, bool);
145 
147 
151  vtkSetStringMacro(ColumnName);
152  vtkGetStringMacro(ColumnName);
154 
155  void SetColumnVisibility(const QString& name, bool status);
156 
162 
168 
170 
174  vtkGetMacro(SortSelectionToTop, bool);
176 
178 
183  vtkGetMacro(ApplyRowColors, bool);
185 
189  void Update() override;
190 
192 
195  void SetColorArrayName(const char* name);
196  const char* GetColorArrayName();
198 
200 
203  void SetColorByArray(bool vis);
205  vtkBooleanMacro(ColorByArray, bool);
207 
211  void ApplyViewTheme(vtkViewTheme* theme) override;
212 
213  enum
214  {
215  SELECT_ITEMS = 0,
217  SELECT_COLUMNS
218  };
219 
221 
230  virtual void SetSelectionBehavior(int type);
231  virtual int GetSelectionBehavior();
233 
242  virtual void GetSelectedItems(vtkIdTypeArray* arr);
243 
244 protected:
246  ~vtkQtTableView() override;
247 
250 
251 private Q_SLOTS:
252  void slotQtSelectionChanged(const QItemSelection&, const QItemSelection&);
253 
254 private:
255  void SetVTKSelection();
256  vtkMTimeType LastSelectionMTime;
257  vtkMTimeType LastInputMTime;
258  vtkMTimeType LastMTime;
259 
260  vtkSetStringMacro(ColorArrayNameInternal);
261  vtkGetStringMacro(ColorArrayNameInternal);
262 
263  QPointer<QTableView> TableView;
264  vtkQtTableModelAdapter* TableAdapter;
265  QSortFilterProxyModel* TableSorter;
266  int FieldType;
267  bool ShowAll;
268  char* ColumnName;
269  bool InSelectionChanged;
270  bool SortSelectionToTop;
271  bool ApplyRowColors;
272  char* ColorArrayNameInternal;
273 
274  vtkSmartPointer<vtkAddMembershipArray> AddSelectedColumn;
275  vtkSmartPointer<vtkDataObjectToTable> DataObjectToTable;
277 
278  vtkQtTableView(const vtkQtTableView&) = delete;
279  void operator=(const vtkQtTableView&) = delete;
280 };
281 
282 #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:113
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:132
@ value
Definition: vtkX3D.h:226
@ type
Definition: vtkX3D.h:522
@ name
Definition: vtkX3D.h:225
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287