VTK  9.0.2
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 -------------------------------------------------------------------------*/
32 #ifndef vtkQtTableView_h
33 #define vtkQtTableView_h
34 
35 #include "vtkQtView.h"
36 #include "vtkViewsQtModule.h" // For export macro
37 
38 #include "vtkSmartPointer.h" // Needed for member variables
39 #include <QPointer> // Needed to hold the view
40 
42 class vtkApplyColors;
44 class vtkIdTypeArray;
45 class QItemSelection;
46 class QSortFilterProxyModel;
47 class QTableView;
49 
50 class VTKVIEWSQT_EXPORT vtkQtTableView : public vtkQtView
51 {
52  Q_OBJECT
53 
54 public:
55  static vtkQtTableView* New();
56  vtkTypeMacro(vtkQtTableView, vtkQtView);
57  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
65  QWidget* GetWidget() override;
66 
71 
76 
77  enum
78  {
79  FIELD_DATA = 0,
80  POINT_DATA = 1,
81  CELL_DATA = 2,
82  VERTEX_DATA = 3,
83  EDGE_DATA = 4,
84  ROW_DATA = 5,
85  };
86 
88 
92  vtkGetMacro(FieldType, int);
93  void SetFieldType(int);
95 
99  void SetEnableDragDrop(bool);
100 
105  void SetSortingEnabled(bool);
106 
108 
113  void SetShowAll(bool);
114  vtkGetMacro(ShowAll, bool);
116 
118 
122  vtkSetStringMacro(ColumnName);
123  vtkGetStringMacro(ColumnName);
125 
126  void SetColumnVisibility(const QString& name, bool status);
127 
133 
139 
141 
145  vtkGetMacro(SortSelectionToTop, bool);
147 
149 
154  vtkGetMacro(ApplyRowColors, bool);
156 
160  void Update() override;
161 
163 
166  void SetColorArrayName(const char* name);
167  const char* GetColorArrayName();
169 
171 
174  void SetColorByArray(bool vis);
176  vtkBooleanMacro(ColorByArray, bool);
178 
182  void ApplyViewTheme(vtkViewTheme* theme) override;
183 
184  enum
185  {
186  SELECT_ITEMS = 0,
188  SELECT_COLUMNS
189  };
190 
192 
201  virtual void SetSelectionBehavior(int type);
202  virtual int GetSelectionBehavior();
204 
213  virtual void GetSelectedItems(vtkIdTypeArray* arr);
214 
215 protected:
217  ~vtkQtTableView() override;
218 
221 
222 private slots:
223  void slotQtSelectionChanged(const QItemSelection&, const QItemSelection&);
224 
225 private:
226  void SetVTKSelection();
227  vtkMTimeType LastSelectionMTime;
228  vtkMTimeType LastInputMTime;
229  vtkMTimeType LastMTime;
230 
231  vtkSetStringMacro(ColorArrayNameInternal);
232  vtkGetStringMacro(ColorArrayNameInternal);
233 
234  QPointer<QTableView> TableView;
235  vtkQtTableModelAdapter* TableAdapter;
236  QSortFilterProxyModel* TableSorter;
237  int FieldType;
238  bool ShowAll;
239  char* ColumnName;
240  bool InSelectionChanged;
241  bool SortSelectionToTop;
242  bool ApplyRowColors;
243  char* ColorArrayNameInternal;
244 
245  vtkSmartPointer<vtkAddMembershipArray> AddSelectedColumn;
246  vtkSmartPointer<vtkDataObjectToTable> DataObjectToTable;
248 
249  vtkQtTableView(const vtkQtTableView&) = delete;
250  void operator=(const vtkQtTableView&) = delete;
251 };
252 
253 #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:34
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()
void SetFieldType(int)
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()
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()
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:43
@ value
Definition: vtkX3D.h:226
@ type
Definition: vtkX3D.h:522
@ name
Definition: vtkX3D.h:225
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293