VTK  9.3.20240419
vtkQtListView.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
16 #ifndef vtkQtListView_h
17 #define vtkQtListView_h
18 
19 #include "vtkQtView.h"
20 #include "vtkViewsQtModule.h" // For export macro
21 
22 #include "vtkSmartPointer.h" // Needed for member variables
23 #include <QImage> // Needed for the icon methods
24 #include <QPointer> // Needed for the internal list view
25 
26 class QItemSelection;
27 class QSortFilterProxyModel;
28 class QListView;
29 
30 VTK_ABI_NAMESPACE_BEGIN
32 class vtkApplyColors;
34 
35 class VTKVIEWSQT_EXPORT vtkQtListView : public vtkQtView
36 {
37  Q_OBJECT
38 
39 public:
40  static vtkQtListView* New();
41  vtkTypeMacro(vtkQtListView, vtkQtView);
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
50  QWidget* GetWidget() override;
51 
52  enum
53  {
54  FIELD_DATA = 0,
55  POINT_DATA = 1,
56  CELL_DATA = 2,
57  VERTEX_DATA = 3,
58  EDGE_DATA = 4,
59  ROW_DATA = 5,
60  };
61 
63 
67  vtkGetMacro(FieldType, int);
68  void SetFieldType(int);
70 
74  void SetEnableDragDrop(bool);
75 
80 
88 
90 
93  void SetColorArrayName(const char* name);
94  const char* GetColorArrayName();
96 
98 
101  void SetColorByArray(bool vis);
103  vtkBooleanMacro(ColorByArray, bool);
105 
109  void SetVisibleColumn(int col);
110 
114 #if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
115  void SetFilterRegExp(const QRegularExpression& pattern);
116 #else
117  void SetFilterRegExp(const QRegExp& pattern);
118 #endif
119 
121 
124  void SetIconSheet(QImage sheet);
125  void SetIconSize(int w, int h);
126  void SetIconSheetSize(int w, int h);
127  void SetIconArrayName(const char* name);
129 
130  void ApplyViewTheme(vtkViewTheme* theme) override;
131 
135  void Update() override;
136 
137 protected:
139  ~vtkQtListView() override;
140 
143 
144 private Q_SLOTS:
145  void slotQtSelectionChanged(const QItemSelection&, const QItemSelection&);
146 
147 private: // NOLINT(readability-redundant-access-specifiers)
148  void SetVTKSelection();
149 
150  vtkMTimeType LastSelectionMTime;
151  vtkMTimeType LastInputMTime;
152  vtkMTimeType LastMTime;
153 
154  vtkSetStringMacro(ColorArrayNameInternal);
155  vtkGetStringMacro(ColorArrayNameInternal);
156  vtkSetStringMacro(IconIndexArrayNameInternal);
157  vtkGetStringMacro(IconIndexArrayNameInternal);
158 
159  QPointer<QListView> ListView;
160  vtkQtTableModelAdapter* TableAdapter;
161  QSortFilterProxyModel* TableSorter;
162  char* ColorArrayNameInternal;
163  char* IconIndexArrayNameInternal;
164  char* VisibleColumnName;
165  bool SortSelectionToTop;
166  bool ApplyRowColors;
167  int FieldType;
168  int VisibleColumn;
169 
172 
173  vtkQtListView(const vtkQtListView&) = delete;
174  void operator=(const vtkQtListView&) = delete;
175 };
176 
177 VTK_ABI_NAMESPACE_END
178 #endif
apply colors to a data set.
this filter produces a vtkTable from the chosen attribute in the input data object.
The superclass for all representations.
a simple class to control print indentation
Definition: vtkIndent.h:108
A VTK view based on a Qt List view.
Definition: vtkQtListView.h:36
void SetColorArrayName(const char *name)
The array to use for coloring items in view.
void Update() override
Updates the view.
~vtkQtListView() override
void SetEnableDragDrop(bool)
Enable drag and drop on this widget.
void SetVisibleColumn(int col)
The column to display.
void RemoveRepresentationInternal(vtkDataRepresentation *rep) override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetAlternatingRowColors(bool)
Have the view alternate its row colors.
void ApplyViewTheme(vtkViewTheme *theme) override
void SetIconArrayName(const char *name)
Set the icon ivars.
const char * GetColorArrayName()
The array to use for coloring items in view.
void SetFilterRegExp(const QRegularExpression &pattern)
The column used to filter on.
void SetIconSheetSize(int w, int h)
Set the icon ivars.
void AddRepresentationInternal(vtkDataRepresentation *rep) override
void SetFieldType(int)
The field type to copy into the output table.
bool GetColorByArray()
Whether to color vertices.
void SetIconSize(int w, int h)
Set the icon ivars.
void SetIconSheet(QImage sheet)
Set the icon ivars.
void SetDecorationStrategy(int)
The strategy for how to decorate rows.
QWidget * GetWidget() override
Get the main container of this view (a QWidget).
void SetColorByArray(bool vis)
Whether to color vertices.
static vtkQtListView * New()
Adapts a table to a Qt item model.
Superclass for Qt widget-based views.
Definition: vtkQtView.h:27
Computes the portion of a dataset which is inside a selection.
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:123
@ name
Definition: vtkX3D.h:219
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270