pqScalarBarVisibilityReaction.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 pqScalarBarVisibilityReaction_h
5 #define pqScalarBarVisibilityReaction_h
6 
7 #include "pqReaction.h"
8 #include <QPointer>
9 
10 #include "vtkNew.h" // For vtkNew
11 
12 #include <vector> // For std::vector
13 
15 class pqTimer;
16 class pqView;
18 class vtkSMProxy;
19 
25 {
26  Q_OBJECT
27  typedef pqReaction Superclass;
28 
29 public:
34  pqScalarBarVisibilityReaction(QAction* parent, bool track_active_objects = true);
36 
40  pqDataRepresentation* representation() const;
41 
43 
46  std::vector<vtkSMProxy*> scalarBarProxies() const;
48  {
49  std::vector<vtkSMProxy*> proxies = this->scalarBarProxies();
50  return proxies.empty() ? nullptr : proxies[0];
51  }
53 
54 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
56 
59  void setRepresentation(pqDataRepresentation*, int selectedPropertiesType);
61  {
62  this->setRepresentation(repr, 0 /*Representation*/);
63  }
64  void setActiveRepresentation();
66 
70  void setScalarBarVisibility(bool visible);
71 
75  void updateEnableState() override;
76 
77 protected:
81  void onTriggered() override { this->setScalarBarVisibility(this->parentAction()->isChecked()); }
82 
83 private:
84  Q_DISABLE_COPY(pqScalarBarVisibilityReaction)
85 
86  QPointer<pqDataRepresentation> Representation;
87  QPointer<pqView> View;
88  QPointer<pqTimer> Timer;
89  vtkNew<vtkSMColorMapEditorHelper> ColorMapEditorHelper;
90 };
91 
92 #endif
pqDataRepresentation is the superclass for a display for a pqPipelineSource i.e.
void onTriggered() override
Called when the action is triggered.
virtual void updateEnableState()
Definition: pqReaction.h:48
#define PQAPPLICATIONCOMPONENTS_EXPORT
Reaction to toggle scalar bar visibility.
This is a PQ abstraction of a generic view module.
Definition: pqView.h:26
This is a superclass just to make it easier to collect all such reactions.
Definition: pqReaction.h:25
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
QAction * parentAction() const
Provides access to the parent action.
Definition: pqReaction.h:40
vtkSMProxy * scalarBarProxy() const
Returns the scalar bar for the current representation, if any.
void setRepresentation(pqDataRepresentation *repr)
Set the representation.
helper for color map editor handling