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 "QVTKWin32Header.h"
35 #include "vtkQtView.h"
36 
37 #include <QPointer>
38 #include <QImage>
39 #include <QSortFilterProxyModel>
41 #include "vtkSmartPointer.h"
42 
43 class vtkApplyColors;
45 class QItemSelection;
46 class QListView;
48 
49 class QVTK_EXPORT vtkQtListView : public vtkQtView
50 {
51 Q_OBJECT
52 
53 public:
54  static vtkQtListView *New();
55  vtkTypeMacro(vtkQtListView, vtkQtView);
56  void PrintSelf(ostream& os, vtkIndent indent);
57 
61  virtual QWidget* GetWidget();
62 
63  enum
64  {
65  FIELD_DATA = 0,
66  POINT_DATA = 1,
67  CELL_DATA = 2,
68  VERTEX_DATA = 3,
69  EDGE_DATA = 4,
70  ROW_DATA = 5,
71  };
72 
74 
76  vtkGetMacro(FieldType, int);
77  void SetFieldType(int);
79 
81  void SetEnableDragDrop(bool);
82 
84  void SetAlternatingRowColors(bool);
85 
89  void SetDecorationStrategy(int);
90 
92 
93  void SetColorArrayName(const char* name);
94  const char* GetColorArrayName();
96 
98 
99  void SetColorByArray(bool vis);
100  bool GetColorByArray();
101  vtkBooleanMacro(ColorByArray, bool);
103 
105  void SetVisibleColumn(int col);
106 
108  void SetFilterRegExp(const QRegExp& pattern);
109 
111 
113  void SetIconSheet(QImage sheet);
114  void SetIconSize(int w, int h);
115  void SetIconSheetSize(int w, int h);
116  void SetIconArrayName(const char* name);
118 
119  virtual void ApplyViewTheme(vtkViewTheme* theme);
120 
122  virtual void Update();
123 
124 protected:
125  vtkQtListView();
126  ~vtkQtListView();
127 
130 
131 private slots:
132  void slotQtSelectionChanged(const QItemSelection&,const QItemSelection&);
133 
134 private:
135  void SetVTKSelection();
136 
137  unsigned long LastSelectionMTime;
138  unsigned long LastInputMTime;
139  unsigned long LastMTime;
140 
141  vtkSetStringMacro(ColorArrayNameInternal);
142  vtkGetStringMacro(ColorArrayNameInternal);
143  vtkSetStringMacro(IconIndexArrayNameInternal);
144  vtkGetStringMacro(IconIndexArrayNameInternal);
145 
146  QPointer<QListView> ListView;
147  vtkQtTableModelAdapter* TableAdapter;
148  QSortFilterProxyModel* TableSorter;
149  char* ColorArrayNameInternal;
150  char* IconIndexArrayNameInternal;
151  char* VisibleColumnName;
152  bool SortSelectionToTop;
153  bool ApplyRowColors;
154  int FieldType;
155  int VisibleColumn;
156 
157  vtkSmartPointer<vtkDataObjectToTable> DataObjectToTable;
159 
160  vtkQtListView(const vtkQtListView&); // Not implemented.
161  void operator=(const vtkQtListView&); // Not implemented.
162 
163 };
164 
165 #endif