VTK  9.1.0
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 -------------------------------------------------------------------------*/
32 #ifndef vtkQtListView_h
33 #define vtkQtListView_h
34 
35 #include "vtkQtView.h"
36 #include "vtkViewsQtModule.h" // For export macro
37 
38 #include "vtkSmartPointer.h" // Needed for member variables
39 #include <QImage> // Needed for the icon methods
40 #include <QPointer> // Needed for the internal list view
41 
42 class vtkApplyColors;
44 class QItemSelection;
45 class QSortFilterProxyModel;
46 class QListView;
48 
49 class VTKVIEWSQT_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) override;
57 
64  QWidget* GetWidget() override;
65 
66  enum
67  {
68  FIELD_DATA = 0,
69  POINT_DATA = 1,
70  CELL_DATA = 2,
71  VERTEX_DATA = 3,
72  EDGE_DATA = 4,
73  ROW_DATA = 5,
74  };
75 
77 
81  vtkGetMacro(FieldType, int);
82  void SetFieldType(int);
84 
88  void SetEnableDragDrop(bool);
89 
94 
102 
104 
107  void SetColorArrayName(const char* name);
108  const char* GetColorArrayName();
110 
112 
115  void SetColorByArray(bool vis);
117  vtkBooleanMacro(ColorByArray, bool);
119 
123  void SetVisibleColumn(int col);
124 
128 #if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
129  void SetFilterRegExp(const QRegularExpression& pattern);
130 #else
131  void SetFilterRegExp(const QRegExp& pattern);
132 #endif
133 
135 
138  void SetIconSheet(QImage sheet);
139  void SetIconSize(int w, int h);
140  void SetIconSheetSize(int w, int h);
141  void SetIconArrayName(const char* name);
143 
144  void ApplyViewTheme(vtkViewTheme* theme) override;
145 
149  void Update() override;
150 
151 protected:
153  ~vtkQtListView() override;
154 
157 
158 private Q_SLOTS:
159  void slotQtSelectionChanged(const QItemSelection&, const QItemSelection&);
160 
161 private:
162  void SetVTKSelection();
163 
164  vtkMTimeType LastSelectionMTime;
165  vtkMTimeType LastInputMTime;
166  vtkMTimeType LastMTime;
167 
168  vtkSetStringMacro(ColorArrayNameInternal);
169  vtkGetStringMacro(ColorArrayNameInternal);
170  vtkSetStringMacro(IconIndexArrayNameInternal);
171  vtkGetStringMacro(IconIndexArrayNameInternal);
172 
173  QPointer<QListView> ListView;
174  vtkQtTableModelAdapter* TableAdapter;
175  QSortFilterProxyModel* TableSorter;
176  char* ColorArrayNameInternal;
177  char* IconIndexArrayNameInternal;
178  char* VisibleColumnName;
179  bool SortSelectionToTop;
180  bool ApplyRowColors;
181  int FieldType;
182  int VisibleColumn;
183 
184  vtkSmartPointer<vtkDataObjectToTable> DataObjectToTable;
186 
187  vtkQtListView(const vtkQtListView&) = delete;
188  void operator=(const vtkQtListView&) = delete;
189 };
190 
191 #endif
vtkQtListView::SetFieldType
void SetFieldType(int)
The field type to copy into the output table.
vtkQtListView::SetIconArrayName
void SetIconArrayName(const char *name)
Set the icon ivars.
vtkQtListView::GetColorByArray
bool GetColorByArray()
Whether to color vertices.
vtkQtListView::New
static vtkQtListView * New()
vtkSmartPointer< vtkDataObjectToTable >
vtkQtListView::GetWidget
QWidget * GetWidget() override
Get the main container of this view (a QWidget).
vtkApplyColors
apply colors to a data set.
Definition: vtkApplyColors.h:87
vtkQtListView::RemoveRepresentationInternal
void RemoveRepresentationInternal(vtkDataRepresentation *rep) override
vtkQtListView::SetIconSize
void SetIconSize(int w, int h)
Set the icon ivars.
vtkQtListView::AddRepresentationInternal
void AddRepresentationInternal(vtkDataRepresentation *rep) override
vtkQtListView::SetColorArrayName
void SetColorArrayName(const char *name)
The array to use for coloring items in view.
vtkQtListView::SetDecorationStrategy
void SetDecorationStrategy(int)
The strategy for how to decorate rows.
vtkQtListView::~vtkQtListView
~vtkQtListView() override
vtkQtListView::SetIconSheet
void SetIconSheet(QImage sheet)
Set the icon ivars.
vtkViewTheme
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:132
vtkQtListView::SetFilterRegExp
void SetFilterRegExp(const QRegularExpression &pattern)
The column used to filter on.
vtkDataRepresentation
The superclass for all representations.
Definition: vtkDataRepresentation.h:92
vtkQtListView::SetAlternatingRowColors
void SetAlternatingRowColors(bool)
Have the view alternate its row colors.
vtkQtListView::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkQtListView::vtkQtListView
vtkQtListView()
vtkQtListView::GetColorArrayName
const char * GetColorArrayName()
The array to use for coloring items in view.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkSmartPointer.h
vtkQtListView::SetColorByArray
void SetColorByArray(bool vis)
Whether to color vertices.
vtkQtListView::Update
void Update() override
Updates the view.
vtkX3D::name
@ name
Definition: vtkX3D.h:225
vtkQtListView
A VTK view based on a Qt List view.
Definition: vtkQtListView.h:50
vtkQtListView::SetIconSheetSize
void SetIconSheetSize(int w, int h)
Set the icon ivars.
vtkQtView.h
vtkQtListView::SetEnableDragDrop
void SetEnableDragDrop(bool)
Enable drag and drop on this widget.
vtkQtTableModelAdapter
Adapts a table to a Qt item model.
Definition: vtkQtTableModelAdapter.h:46
vtkQtView
Superclass for Qt widget-based views.
Definition: vtkQtView.h:34
vtkDataObjectToTable
extract field data as a table
Definition: vtkDataObjectToTable.h:65
vtkQtListView::SetVisibleColumn
void SetVisibleColumn(int col)
The column to display.
vtkQtListView::ApplyViewTheme
void ApplyViewTheme(vtkViewTheme *theme) override
h
vtkFrustumSelector is a vtkSelector that selects elements based on whether they are inside or interse...
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287