VTK
vtkQtListView.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkQtListView.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 -------------------------------------------------------------------------*/
31 #ifndef vtkQtListView_h
32 #define vtkQtListView_h
33 
34 #include "vtkViewsQtModule.h" // For export macro
35 #include "QVTKWin32Header.h"
36 #include "vtkQtView.h"
37 
38 #include <QPointer>
39 #include <QImage>
40 #include <QSortFilterProxyModel>
42 #include "vtkSmartPointer.h"
43 
44 class vtkApplyColors;
46 class QItemSelection;
47 class QListView;
49 
50 class VTKVIEWSQT_EXPORT vtkQtListView : public vtkQtView
51 {
52 Q_OBJECT
53 
54 public:
55  static vtkQtListView *New();
56  vtkTypeMacro(vtkQtListView, vtkQtView);
57  void PrintSelf(ostream& os, vtkIndent indent);
58 
62  virtual QWidget* GetWidget();
63 
64  enum
65  {
66  FIELD_DATA = 0,
67  POINT_DATA = 1,
68  CELL_DATA = 2,
69  VERTEX_DATA = 3,
70  EDGE_DATA = 4,
71  ROW_DATA = 5,
72  };
73 
75 
77  vtkGetMacro(FieldType, int);
78  void SetFieldType(int);
80 
82  void SetEnableDragDrop(bool);
83 
85  void SetAlternatingRowColors(bool);
86 
90  void SetDecorationStrategy(int);
91 
93 
94  void SetColorArrayName(const char* name);
95  const char* GetColorArrayName();
97 
99 
100  void SetColorByArray(bool vis);
101  bool GetColorByArray();
102  vtkBooleanMacro(ColorByArray, bool);
104 
106  void SetVisibleColumn(int col);
107 
109  void SetFilterRegExp(const QRegExp& pattern);
110 
112 
114  void SetIconSheet(QImage sheet);
115  void SetIconSize(int w, int h);
116  void SetIconSheetSize(int w, int h);
117  void SetIconArrayName(const char* name);
119 
120  virtual void ApplyViewTheme(vtkViewTheme* theme);
121 
123  virtual void Update();
124 
125 protected:
126  vtkQtListView();
127  ~vtkQtListView();
128 
131 
132 private slots:
133  void slotQtSelectionChanged(const QItemSelection&,const QItemSelection&);
134 
135 private:
136  void SetVTKSelection();
137 
138  unsigned long LastSelectionMTime;
139  unsigned long LastInputMTime;
140  unsigned long LastMTime;
141 
142  vtkSetStringMacro(ColorArrayNameInternal);
143  vtkGetStringMacro(ColorArrayNameInternal);
144  vtkSetStringMacro(IconIndexArrayNameInternal);
145  vtkGetStringMacro(IconIndexArrayNameInternal);
146 
147  QPointer<QListView> ListView;
148  vtkQtTableModelAdapter* TableAdapter;
149  QSortFilterProxyModel* TableSorter;
150  char* ColorArrayNameInternal;
151  char* IconIndexArrayNameInternal;
152  char* VisibleColumnName;
153  bool SortSelectionToTop;
154  bool ApplyRowColors;
155  int FieldType;
156  int VisibleColumn;
157 
158  vtkSmartPointer<vtkDataObjectToTable> DataObjectToTable;
160 
161  vtkQtListView(const vtkQtListView&); // Not implemented.
162  void operator=(const vtkQtListView&); // Not implemented.
163 
164 };
165 
166 #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
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:47
a simple class to control print indentation
Definition: vtkIndent.h:38
void PrintSelf(ostream &os, vtkIndent indent)
The superclass for all representations.
A VTK view based on a Qt List view.
Definition: vtkQtListView.h:50
apply colors to a data set.
Superclass for Qt widget-based views.
Definition: vtkQtView.h:31
virtual void RemoveRepresentationInternal(vtkDataRepresentation *vtkNotUsed(rep))
Definition: vtkView.h:204