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 -------------------------------------------------------------------------*/
38 #ifndef vtkQtTableView_h
39 #define vtkQtTableView_h
40 
41 #include "vtkViewsQtModule.h" // For export macro
42 #include "vtkQtView.h"
43 
44 #include <QPointer> // Needed to hold the view
45 #include "vtkSmartPointer.h" // Needed for member variables
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);
64 
71  virtual QWidget* GetWidget();
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  virtual void Update();
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  virtual void ApplyViewTheme(vtkViewTheme* theme);
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:
224 
227 
228 private 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&) VTK_DELETE_FUNCTION;
256  void operator=(const vtkQtTableView&) VTK_DELETE_FUNCTION;
257 
258 };
259 
260 #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:40
Adapts a table to a Qt item model.
A VTK view based on a Qt Table view.
void SetColumnVisibility(const QString &name, bool status)
virtual void AddRepresentationInternal(vtkDataRepresentation *rep)
void SetEnableDragDrop(bool)
Enable drag and drop on this widget.
bool GetColorByArray()
void SetFieldType(int)
virtual QWidget * GetWidget()
Get the main container of this view (a QWidget).
void SetSplitMultiComponentColumns(bool value)
Set whether or not the table view should split multi-component columns into multiple single-component...
virtual void RemoveRepresentationInternal(vtkDataRepresentation *rep)
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.
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.
virtual void ApplyViewTheme(vtkViewTheme *theme)
Apply a view theme to this view.
void SetColorArrayName(const char *name)
The array to use for coloring items in view.
void SetApplyRowColors(bool value)
Whether or not to add an icon to the row header denoting the color of an annotated row.
virtual void Update()
Updates the view.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
Superclass for Qt widget-based views.
Definition: vtkQtView.h:32
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:49
@ value
Definition: vtkX3D.h:220
@ type
Definition: vtkX3D.h:516
@ name
Definition: vtkX3D.h:219
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248