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 <QPair>
10 #include <QPointer>
11 #include <QWidget>
12 
14 class pqScalarsToColors;
15 class QComboBox;
17 class vtkSMProxy;
18 class vtkSMViewProxy;
19 
29 {
30  Q_OBJECT
31  Q_PROPERTY(QString representationText READ representationText WRITE setRepresentationText);
32  typedef QWidget Superclass;
33 
34 public:
35  typedef QPair<int, QString> ValueType;
36 
37  pqDisplayColorWidget(QWidget* parent = nullptr);
38  ~pqDisplayColorWidget() override;
39 
43  ValueType arraySelection() const;
44  QString getCurrentText() const { return this->arraySelection().second; }
45 
49  int componentNumber() const;
50 
54  vtkSMViewProxy* viewProxy() const;
55 
60  static void updateScalarBarVisibility(vtkSMViewProxy* view, vtkSMProxy* reprProxy);
61 
65  QString representationText() const { return this->RepresentationText; }
66 
67 Q_SIGNALS:
71  void arraySelectionChanged();
72 
76  void representationTextChanged(const QString& text);
77 
78 public Q_SLOTS:
82  void setRepresentation(pqDataRepresentation* display);
83 
87  void setRepresentationText(const QString& text);
88 
89 private Q_SLOTS:
94  void refreshColorArrayNames();
95 
99  void renderActiveView();
100 
104  void refreshComponents();
105 
111  void updateColorTransferFunction();
112 
117  void componentNumberChanged();
118 
124  void pruneOutOfDomainEntries();
125 
126 protected:
130  void setArraySelection(const ValueType&);
134  void setComponentNumber(int);
135 
136 private:
137  QVariant itemData(int association, const QString& arrayName) const;
138  QIcon* itemIcon(int association, const QString& arrayName) const;
139 
148  int addOutOfDomainEntry(int association, const QString& arrayName);
149 
150  QIcon* CellDataIcon;
151  QIcon* PointDataIcon;
152  QIcon* FieldDataIcon;
153  QIcon* SolidColorIcon;
154  QComboBox* Variables;
155  QComboBox* Components;
156  QPointer<pqDataRepresentation> Representation;
157  QPointer<pqScalarsToColors> ColorTransferFunction;
158  QString RepresentationText;
159 
160  // This is maintained to detect when the representation has changed.
161  void* CachedRepresentation;
162 
163  class pqInternals;
164  pqInternals* Internals;
165 
166  class PropertyLinksConnection;
167  friend class PropertyLinksConnection;
168 };
169 #endif
pqDataRepresentation is the superclass for a display for a pqPipelineSource i.e.
#define PQCOMPONENTS_EXPORT
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