VTK  9.3.1
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 
79  void SetAlternatingRowColors(bool);
80 
87  void SetDecorationStrategy(int);
88 
90 
93  void SetColorArrayName(const char* name);
94  const char* GetColorArrayName();
96 
98 
101  void SetColorByArray(bool vis);
102  bool GetColorByArray();
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:
138  vtkQtListView();
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
virtual void ApplyViewTheme(vtkViewTheme *vtkNotUsed(theme))
Apply a theme to the view.
Definition: vtkView.h:141
Adapts a table to a Qt item model.
static vtkView * New()
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
virtual void Update()
Update the view.
this filter produces a vtkTable from the chosen attribute in the input data object.
virtual QWidget * GetWidget()=0
Get the main container of this view (a QWidget).
virtual void AddRepresentationInternal(vtkDataRepresentation *vtkNotUsed(rep))
Subclass "hooks" for notifying subclasses of vtkView when representations are added or removed...
Definition: vtkView.h:219
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:33
a simple class to control print indentation
Definition: vtkIndent.h:28
The superclass for all representations.
A VTK view based on a Qt List view.
Definition: vtkQtListView.h:35
apply colors to a data set.
Superclass for Qt widget-based views.
Definition: vtkQtView.h:24
virtual void RemoveRepresentationInternal(vtkDataRepresentation *vtkNotUsed(rep))
Meant for use by subclasses and vtkRepresentation subclasses.
Definition: vtkView.h:220