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 "vtkQtView.h"
36 
37 #include <QPointer> // Needed for the internal list view
38 #include <QImage> // Needed for the icon methods
39 #include "vtkSmartPointer.h" // Needed for member variables
40 
41 class vtkApplyColors;
43 class QItemSelection;
44 class QSortFilterProxyModel;
45 class QListView;
47 
49 {
50 Q_OBJECT
51 
52 public:
53  static vtkQtListView *New();
54  vtkTypeMacro(vtkQtListView, vtkQtView);
55  void PrintSelf(ostream& os, vtkIndent indent);
56 
60  virtual QWidget* GetWidget();
61 
62  enum
63  {
64  FIELD_DATA = 0,
65  POINT_DATA = 1,
66  CELL_DATA = 2,
67  VERTEX_DATA = 3,
68  EDGE_DATA = 4,
69  ROW_DATA = 5,
70  };
71 
73 
75  vtkGetMacro(FieldType, int);
76  void SetFieldType(int);
78 
80  void SetEnableDragDrop(bool);
81 
83  void SetAlternatingRowColors(bool);
84 
88  void SetDecorationStrategy(int);
89 
91 
92  void SetColorArrayName(const char* name);
93  const char* GetColorArrayName();
95 
97 
98  void SetColorByArray(bool vis);
99  bool GetColorByArray();
100  vtkBooleanMacro(ColorByArray, bool);
102 
104  void SetVisibleColumn(int col);
105 
107  void SetFilterRegExp(const QRegExp& pattern);
108 
110 
112  void SetIconSheet(QImage sheet);
113  void SetIconSize(int w, int h);
114  void SetIconSheetSize(int w, int h);
115  void SetIconArrayName(const char* name);
117 
118  virtual void ApplyViewTheme(vtkViewTheme* theme);
119 
121  virtual void Update();
122 
123 protected:
124  vtkQtListView();
125  ~vtkQtListView();
126 
129 
130 private slots:
131  void slotQtSelectionChanged(const QItemSelection&,const QItemSelection&);
132 
133 private:
134  void SetVTKSelection();
135 
136  unsigned long LastSelectionMTime;
137  unsigned long LastInputMTime;
138  unsigned long LastMTime;
139 
140  vtkSetStringMacro(ColorArrayNameInternal);
141  vtkGetStringMacro(ColorArrayNameInternal);
142  vtkSetStringMacro(IconIndexArrayNameInternal);
143  vtkGetStringMacro(IconIndexArrayNameInternal);
144 
145  QPointer<QListView> ListView;
146  vtkQtTableModelAdapter* TableAdapter;
147  QSortFilterProxyModel* TableSorter;
148  char* ColorArrayNameInternal;
149  char* IconIndexArrayNameInternal;
150  char* VisibleColumnName;
151  bool SortSelectionToTop;
152  bool ApplyRowColors;
153  int FieldType;
154  int VisibleColumn;
155 
156  vtkSmartPointer<vtkDataObjectToTable> DataObjectToTable;
158 
159  vtkQtListView(const vtkQtListView&); // Not implemented.
160  void operator=(const vtkQtListView&); // Not implemented.
161 
162 };
163 
164 #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
#define VTKVIEWSQT_EXPORT
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:48
apply colors to a data set.
Superclass for Qt widget-based views.
Definition: vtkQtView.h:30
virtual void RemoveRepresentationInternal(vtkDataRepresentation *vtkNotUsed(rep))
Definition: vtkView.h:204