pqSpreadSheetViewModel.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 #ifndef pqSpreadSheetViewModel_h
5 #define pqSpreadSheetViewModel_h
6 
7 #include "pqCoreModule.h"
8 #include "vtkTuple.h" // needed for vtkTuple.
9 #include "vtkType.h" // needed for vtkIdType.
10 #include <QAbstractTableModel>
11 #include <QPair>
12 #include <QSet>
13 
21 class QItemSelection;
22 class QItemSelectionModel;
23 class vtkObject;
24 class vtkSelection;
25 class vtkSelectionNode;
26 class vtkSMProxy;
27 class vtkSpreadSheetView;
28 
29 class PQCORE_EXPORT pqSpreadSheetViewModel : public QAbstractTableModel
30 {
31  Q_OBJECT
32  typedef QAbstractTableModel Superclass;
33 
34 public:
35  pqSpreadSheetViewModel(vtkSMProxy* viewProxy, QObject* parent = nullptr);
36  ~pqSpreadSheetViewModel() override;
37 
38  class vtkIndex : public vtkTuple<vtkIdType, 3>
39  {
40  };
41 
45  int rowCount(const QModelIndex& parent = QModelIndex()) const override;
46 
50  int columnCount(const QModelIndex& parent = QModelIndex()) const override;
51 
56  QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
57 
71  QVariant headerData(
72  int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
73 
77  void sortSection(int section, Qt::SortOrder order);
78 
82  bool isSortable(int section);
83 
87  int getFieldType() const;
88 
89  // Returns the vtk indices for the view indices.
90  QSet<vtkIndex> getVTKIndices(const QModelIndexList& indexes);
91 
95  void setDecimalPrecision(int);
96  int getDecimalPrecision();
97 
101  void setFixedRepresentation(bool);
102  bool getFixedRepresentation();
103 
110  void setActiveRegion(int row_top, int row_bottom);
111 
116  pqDataRepresentation* activeRepresentation() const;
117  vtkSMProxy* activeRepresentationProxy() const;
118 
122  Qt::ItemFlags flags(const QModelIndex& index) const override;
123  bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
124 
125  enum
126  {
127  SectionInternal = Qt::UserRole + 1,
129  };
130 
135  QString GetRowsAsString() const;
136 
137 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
141  void forceUpdate();
142 
147  void setActiveRepresentation(pqDataRepresentation*);
148 
154  void setActiveRepresentationProxy(vtkSMProxy*);
155 
156 Q_SIGNALS:
160  void selectionChanged(const QItemSelection& selection);
161 
162 private Q_SLOTS:
166  void delayedUpdate();
167 
168  void triggerSelectionChanged();
169 
174  void onDataFetched(vtkObject*, unsigned long, void*, void* call_data);
175 
179  void hiddenColumnsChanged();
180 
181 protected:
186  bool isDataValid(const QModelIndex& idx) const;
187 
188  vtkSpreadSheetView* GetView() const;
189 
190 private:
191  Q_DISABLE_COPY(pqSpreadSheetViewModel)
192 
193  class pqInternal;
194  pqInternal* Internal;
195 
196  vtkSMProxy* ViewProxy;
197 };
198 
199 #endif
data
pqDataRepresentation is the superclass for a display for a pqPipelineSource i.e.
order
vtkSpreadSheetView is a vtkPVView subclass for a view used to show any data as a spreadsheet.
#define PQCORE_EXPORT
Definition: pqCoreModule.h:15
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
value
orientation
index