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