pqDisplayColorWidget.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 pqDisplayColorWidget_h
5 #define pqDisplayColorWidget_h
6 
7 #include "pqComponentsModule.h"
8 
9 #include <QIcon>
10 #include <QPair>
11 #include <QPointer>
12 #include <QScopedPointer>
13 #include <QWidget>
14 
15 #include <vector>
16 
17 class QComboBox;
19 class pqScalarsToColors;
20 class vtkSMProxy;
21 class vtkSMViewProxy;
22 
31 class PQCOMPONENTS_EXPORT pqDisplayColorWidget : public QWidget
32 {
33  Q_OBJECT
34  Q_PROPERTY(QString representationText READ representationText WRITE setRepresentationText);
35  typedef QWidget Superclass;
36 
37 public:
38  typedef QPair<int, QString> ValueType;
39 
40  pqDisplayColorWidget(QWidget* parent = nullptr);
41  ~pqDisplayColorWidget() override;
42 
46  ValueType arraySelection() const;
47  QString getCurrentText() const { return this->arraySelection().second; }
48 
52  int componentNumber() const;
53 
57  vtkSMViewProxy* viewProxy() const;
58 
62  static void hideScalarBarsIfNotNeeded(vtkSMViewProxy* view, std::vector<vtkSMProxy*> luts);
63 
68  static void updateScalarBarVisibility(
69  vtkSMViewProxy* view, vtkSMProxy* reprProxy, int selectedPropertiesType = 0 /*Representation*/);
70 
74  QString representationText() const { return this->RepresentationText; }
75 
76 Q_SIGNALS:
80  void arraySelectionChanged();
81 
85  void representationTextChanged(const QString& text);
86 
87 public Q_SLOTS:
89 
92  void setRepresentation(pqDataRepresentation* display, int selectedPropertiesType);
94  {
95  this->setRepresentation(display, 0 /*Representation*/);
96  }
98 
102  void setRepresentationText(const QString& text);
103 
107  void queryCurrentSelectedArray();
108 
109 private Q_SLOTS:
114  void refreshColorArrayNames();
115 
119  void renderActiveView();
120 
124  void refreshComponents();
125 
131  void updateColorTransferFunction();
132 
137  void componentNumberChanged();
138 
144  void pruneOutOfDomainEntries();
145 
149  void pruneOutOfDomainComponentEntries();
150 
151 protected:
155  void setArraySelection(const ValueType&);
159  void setComponentNumber(int);
160 
161 private:
162  QVariant itemData(int association, const QString& arrayName) const;
163  QIcon* itemIcon(int association, const QString& arrayName) const;
164 
173  int addOutOfDomainEntry(int association, const QString& arrayName);
174  int addOutOfDomainComponentEntry(const QString& componentName, int index);
175 
176  QScopedPointer<QIcon> CellDataIcon;
177  QScopedPointer<QIcon> PointDataIcon;
178  QScopedPointer<QIcon> FieldDataIcon;
179  QScopedPointer<QIcon> SolidColorIcon;
180  QComboBox* Variables;
181  QComboBox* Components;
182  QPointer<pqDataRepresentation> Representation;
183  QPointer<pqScalarsToColors> ColorTransferFunction;
184  QString RepresentationText;
185 
186  class pqInternals;
187  QScopedPointer<pqInternals> Internals;
188 
189  class PropertyLinksConnection;
190  friend class PropertyLinksConnection;
191 };
192 #endif
pqDataRepresentation is the superclass for a display for a pqPipelineSource i.e.
pqScalarsToColors is a represents a vtkScalarsToColors proxy.
Superclass for all view proxies.
pqDisplayColorWidget is a widget that can be used to select the array to with for representations (al...
QString getCurrentText() const
QString representationText() const
Returns the selected representation type as a string.
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
QPair< int, QString > ValueType
void setRepresentation(pqDataRepresentation *display)
Set the representation to control the scalar coloring properties on.
index