pqProxyWidget.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 pqProxyWidget_h
5 #define pqProxyWidget_h
6 
7 #include "pqComponentsModule.h"
8 #include <QSet>
9 #include <QWidget>
10 
11 class pqPropertyWidget;
12 class pqView;
13 class vtkSMProperty;
14 class vtkSMProxy;
15 class QPoint;
16 
28 class PQCOMPONENTS_EXPORT pqProxyWidget : public QWidget
29 {
30  Q_OBJECT
31  typedef QWidget Superclass;
32 
33 public:
34  pqProxyWidget(vtkSMProxy* proxy, const QStringList& properties,
35  std::initializer_list<QString> defaultLabels, std::initializer_list<QString> advancedLabels,
36  bool showHeadersFooters = true, QWidget* parent = nullptr,
37  Qt::WindowFlags flags = Qt::WindowFlags{});
38 
39  pqProxyWidget(vtkSMProxy* proxy, std::initializer_list<QString> defaultLabels,
40  std::initializer_list<QString> advancedLabels, QWidget* parent = nullptr,
41  Qt::WindowFlags flags = Qt::WindowFlags{});
42 
43  pqProxyWidget(vtkSMProxy* proxy, const QStringList& properties, bool showHeadersFooters = true,
44  QWidget* parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags{});
45 
46  pqProxyWidget(vtkSMProxy* proxy, QWidget* parent, Qt::WindowFlags flags = Qt::WindowFlags{});
47 
48  pqProxyWidget(vtkSMProxy* proxy);
49 
50  ~pqProxyWidget() override;
51 
55  vtkSMProxy* proxy() const;
56 
62  void setApplyChangesImmediately(bool value);
63  bool applyChangesImmediately() const { return this->ApplyChangesImmediately; }
64 
71  bool useDocumentationForLabels() const { return this->UseDocumentationForLabels; }
72 
78  static QWidget* newGroupLabelWidget(const QString& label, QWidget* parentWidget,
79  const QList<QWidget*>& buttons = QList<QWidget*>());
80 
86  static bool useDocumentationForLabels(vtkSMProxy* proxy);
87 
89  {
93  USE_LONG_HELP
94  };
95 
100  static QString documentationText(
101  vtkSMProperty* property, DocumentationType type = USE_DESCRIPTION);
102 
107  static QString documentationText(vtkSMProxy* property, DocumentationType type = USE_DESCRIPTION);
108 
114  static DocumentationType showProxyDocumentationInPanel(vtkSMProxy* proxy);
115 
117 
129  const QSet<QString>& defaultVisibilityLabels() const { return this->DefaultVisibilityLabels; }
130  const QSet<QString>& advancedVisibilityLabels() const { return this->AdvancedVisibilityLabels; }
132 
133  void showContextMenu(const QPoint& pt, pqPropertyWidget* propWidget);
134 
135 Q_SIGNALS:
140  void changeAvailable();
141 
146  void changeFinished();
147 
152  void restartRequired();
153 
154 public Q_SLOTS:
161  bool filterWidgets(bool show_advanced = false, const QString& filterText = QString());
162 
167  void showLinkedInteractiveWidget(int portIndex, bool show, bool changeFocus);
168 
172  virtual void apply() const;
173 
177  void reset() const;
178 
182  void setView(pqView*);
183 
188  void updatePanel();
189 
194  virtual bool restoreDefaults();
195 
199  void saveAsDefaults() const;
200 
204  static pqPropertyWidget* createWidgetForProperty(
205  vtkSMProperty* property, vtkSMProxy* proxy, QWidget* parentObj);
206 
207 protected:
208  void showEvent(QShowEvent* event) override;
209  void hideEvent(QHideEvent* event) override;
210 
211  void applyInternal() const;
212 
213 protected Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
218  virtual void onChangeFinished();
219 
220 private:
224  void createWidgets(const QStringList& properties = QStringList());
225 
229  void createPropertyWidgets(const QStringList& properties = QStringList());
230 
234  void create3DWidgets();
235 
240  bool shouldPreservePropertyValues() const;
241 
247  bool resetProperty(vtkSMProperty* prop, double settingsPriority, bool warn);
248 
252  void resetPropertyToAppDefault(pqPropertyWidget* propWidget);
253 
257  void resetPropertyToUserDefault(pqPropertyWidget* propWidget);
258 
259  Q_DISABLE_COPY(pqProxyWidget);
260 
261  QSet<QString> DefaultVisibilityLabels;
262  QSet<QString> AdvancedVisibilityLabels;
263  bool ApplyChangesImmediately;
264  bool UseDocumentationForLabels;
265  bool ShowHeadersFooters = false;
266  class pqInternals;
267  pqInternals* Internals;
268 };
269 
270 #endif
pqPropertyWidget represents a widget created for each property of a proxy on the pqPropertiesPanel (f...
bool applyChangesImmediately() const
Definition: pqProxyWidget.h:63
bool useDocumentationForLabels() const
When this is true, the panel uses a descriptive layout where the documentation for properties is used...
Definition: pqProxyWidget.h:71
superclass for all SM properties
This is a PQ abstraction of a generic view module.
Definition: pqView.h:26
const QSet< QString > & advancedVisibilityLabels() const
pqProxyWidget shows widgets for properties in two configurations: basic and advanced.
const QSet< QString > & defaultVisibilityLabels() const
pqProxyWidget shows widgets for properties in two configurations: basic and advanced.
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
value
pqProxyWidget represents a panel for a vtkSMProxy.
Definition: pqProxyWidget.h:28