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 -------------------------------------------------------------------------*/
37 #ifndef vtkQtTableView_h
38 #define vtkQtTableView_h
39 
40 #include "vtkViewsQtModule.h" // For export macro
41 #include "QVTKWin32Header.h"
42 #include "vtkQtView.h"
43 
44 #include <QPointer>
45 #include <QSortFilterProxyModel>
47 #include "vtkSmartPointer.h"
48 
50 class vtkApplyColors;
52 class vtkIdTypeArray;
53 class QItemSelection;
54 class QTableView;
56 
57 class VTKVIEWSQT_EXPORT vtkQtTableView : public vtkQtView
58 {
59 Q_OBJECT
60 
61 public:
62  static vtkQtTableView *New();
63  vtkTypeMacro(vtkQtTableView, vtkQtView);
64  void PrintSelf(ostream& os, vtkIndent indent);
65 
69  virtual QWidget* GetWidget();
70 
72  void SetShowVerticalHeaders(bool);
73 
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 
90  vtkGetMacro(FieldType, int);
91  void SetFieldType(int);
93 
95  void SetEnableDragDrop(bool);
96 
99  void SetSortingEnabled(bool);
100 
102 
105  void SetShowAll(bool);
106  vtkGetMacro(ShowAll, bool);
108 
110 
112  vtkSetStringMacro(ColumnName);
113  vtkGetStringMacro(ColumnName);
115 
116  void SetColumnVisibility(const QString &name, bool status);
117 
120  void SetSplitMultiComponentColumns(bool value);
121 
124  bool GetSplitMultiComponentColumns();
125 
127 
128  void SetSortSelectionToTop(bool value);
129  vtkGetMacro(SortSelectionToTop, bool);
131 
133 
135  void SetApplyRowColors(bool value);
136  vtkGetMacro(ApplyRowColors, bool);
138 
140  virtual void Update();
141 
143 
144  void SetColorArrayName(const char* name);
145  const char* GetColorArrayName();
147 
149 
150  void SetColorByArray(bool vis);
151  bool GetColorByArray();
152  vtkBooleanMacro(ColorByArray, bool);
154 
156  virtual void ApplyViewTheme(vtkViewTheme* theme);
157 
158  enum
159  {
160  SELECT_ITEMS = 0,
162  SELECT_COLUMNS
163  };
164 
166 
171  virtual void SetSelectionBehavior(int type);
172  virtual int GetSelectionBehavior();
174 
180  virtual void GetSelectedItems(vtkIdTypeArray* arr);
181 
182 protected:
183  vtkQtTableView();
184  ~vtkQtTableView();
185 
188 
189 private slots:
190  void slotQtSelectionChanged(const QItemSelection&,const QItemSelection&);
191 
192 private:
193  void SetVTKSelection();
194  unsigned long LastSelectionMTime;
195  unsigned long LastInputMTime;
196  unsigned long LastMTime;
197 
198  vtkSetStringMacro(ColorArrayNameInternal);
199  vtkGetStringMacro(ColorArrayNameInternal);
200 
201  QPointer<QTableView> TableView;
202  vtkQtTableModelAdapter* TableAdapter;
203  QSortFilterProxyModel* TableSorter;
204  int FieldType;
205  bool ShowAll;
206  char* ColumnName;
207  bool InSelectionChanged;
208  bool SortSelectionToTop;
209  bool ApplyRowColors;
210  char* ColorArrayNameInternal;
211 
212  vtkSmartPointer<vtkAddMembershipArray> AddSelectedColumn;
213  vtkSmartPointer<vtkDataObjectToTable> DataObjectToTable;
215 
216  vtkQtTableView(const vtkQtTableView&); // Not implemented.
217  void operator=(const vtkQtTableView&); // Not implemented.
218 
219 };
220 
221 #endif
virtual void ApplyViewTheme(vtkViewTheme *vtkNotUsed(theme))
Definition: vtkView.h:125
Adapts a table to a Qt item model.
static vtkView * New()
virtual void Update()
extract field data as a table
virtual QWidget * GetWidget()=0
virtual void AddRepresentationInternal(vtkDataRepresentation *vtkNotUsed(rep))
Definition: vtkView.h:203
dynamic, self-adjusting array of vtkIdType
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:47
A VTK view based on a Qt Table view.
a simple class to control print indentation
Definition: vtkIndent.h:38
void PrintSelf(ostream &os, vtkIndent indent)
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))
Definition: vtkView.h:204