VTK
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 "vtkViewsQtModule.h" // For export macro
36 #include "vtkQtView.h"
37 
38 #include <QPointer> // Needed to hold the view
39 #include "vtkSmartPointer.h" // Needed for member variables
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 
70  void SetShowVerticalHeaders(bool);
71 
75  void SetShowHorizontalHeaders(bool);
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 
132  void SetSplitMultiComponentColumns(bool value);
133 
138  bool GetSplitMultiComponentColumns();
139 
141 
144  void SetSortSelectionToTop(bool value);
145  vtkGetMacro(SortSelectionToTop, bool);
147 
149 
153  void SetApplyRowColors(bool value);
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);
175  bool GetColorByArray();
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:
216  vtkQtTableView();
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 
254 #endif
virtual void ApplyViewTheme(vtkViewTheme *vtkNotUsed(theme))
Apply a theme to the view.
Definition: vtkView.h:147
Adapts a table to a Qt item model.
static vtkView * New()
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:300
virtual void Update()
Update the view.
extract field data as a table
virtual QWidget * GetWidget()=0
Get the main container of this view (a QWidget).
virtual void AddRepresentationInternal(vtkDataRepresentation *vtkNotUsed(rep))
Subclass "hooks" for notifying subclasses of vtkView when representations are added or removed...
Definition: vtkView.h:231
dynamic, self-adjusting array of vtkIdType
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:42
A VTK view based on a Qt Table view.
a simple class to control print indentation
Definition: vtkIndent.h:33
The superclass for all representations.
apply colors to a data set.
Add an array to the output indicating membership within an input selection.
Superclass for Qt widget-based views.
Definition: vtkQtView.h:31
virtual void RemoveRepresentationInternal(vtkDataRepresentation *vtkNotUsed(rep))
Meant for use by subclasses and vtkRepresentation subclasses.
Definition: vtkView.h:232