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 pqLabel;
12 class pqPropertyWidget;
13 class pqView;
14 class vtkSMProperty;
15 class vtkSMProxy;
16 class QPoint;
17 class QToolButton;
18 
30 class PQCOMPONENTS_EXPORT pqProxyWidget : public QWidget
31 {
32  Q_OBJECT
33  typedef QWidget Superclass;
34 
35 public:
36  pqProxyWidget(vtkSMProxy* proxy, const QStringList& properties,
37  std::initializer_list<QString> defaultLabels, std::initializer_list<QString> advancedLabels,
38  bool showHeadersFooters = true, QWidget* parent = nullptr,
39  Qt::WindowFlags flags = Qt::WindowFlags{});
40 
41  pqProxyWidget(vtkSMProxy* proxy, std::initializer_list<QString> defaultLabels,
42  std::initializer_list<QString> advancedLabels, QWidget* parent = nullptr,
43  Qt::WindowFlags flags = Qt::WindowFlags{});
44 
45  pqProxyWidget(vtkSMProxy* proxy, const QStringList& properties, bool showHeadersFooters = true,
46  QWidget* parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags{});
47 
48  pqProxyWidget(vtkSMProxy* proxy, QWidget* parent, Qt::WindowFlags flags = Qt::WindowFlags{});
49 
50  pqProxyWidget(vtkSMProxy* proxy);
51 
52  ~pqProxyWidget() override;
53 
57  vtkSMProxy* proxy() const;
58 
64  void setApplyChangesImmediately(bool value);
65  bool applyChangesImmediately() const { return this->ApplyChangesImmediately; }
66 
73  bool useDocumentationForLabels() const { return this->UseDocumentationForLabels; }
74 
76 
81  static QWidget* newGroupLabelWidget(
82  const QString& label, QWidget* parentWidget, const QList<QWidget*>& buttons);
83  static QWidget* newGroupLabelWidget(const QString& label, QWidget* parentWidget,
84  pqLabel** titleLabel = nullptr, QToolButton** collapseButton = nullptr);
86 
92  static bool useDocumentationForLabels(vtkSMProxy* proxy);
93 
95  {
99  USE_LONG_HELP
100  };
101 
106  static QString documentationText(
107  vtkSMProperty* property, DocumentationType type = USE_DESCRIPTION);
108 
113  static QString documentationText(vtkSMProxy* property, DocumentationType type = USE_DESCRIPTION);
114 
120  static DocumentationType showProxyDocumentationInPanel(vtkSMProxy* proxy);
121 
123 
135  const QSet<QString>& defaultVisibilityLabels() const { return this->DefaultVisibilityLabels; }
136  const QSet<QString>& advancedVisibilityLabels() const { return this->AdvancedVisibilityLabels; }
138 
139  void showContextMenu(const QPoint& pt, pqPropertyWidget* propWidget);
140 
141 Q_SIGNALS:
146  void changeAvailable();
147 
152  void changeFinished();
153 
158  void restartRequired();
159 
160 public Q_SLOTS:
167  bool filterWidgets(bool show_advanced = false, const QString& filterText = QString());
168 
173  void showLinkedInteractiveWidget(int portIndex, bool show, bool changeFocus);
174 
178  virtual void apply() const;
179 
183  void reset() const;
184 
188  void setView(pqView*);
189 
194  void updatePanel();
195 
200  virtual bool restoreDefaults();
201 
205  void saveAsDefaults() const;
206 
210  static pqPropertyWidget* createWidgetForProperty(
211  vtkSMProperty* property, vtkSMProxy* proxy, QWidget* parentObj);
212 
213 protected:
214  void showEvent(QShowEvent* event) override;
215  void hideEvent(QHideEvent* event) override;
216 
217  void applyInternal() const;
218 
219 protected Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
224  virtual void onChangeFinished();
225 
226 private:
230  void createWidgets(const QStringList& properties = QStringList());
231 
235  void createPropertyWidgets(const QStringList& properties = QStringList());
236 
240  void create3DWidgets();
241 
246  bool shouldPreservePropertyValues() const;
247 
253  bool resetProperty(vtkSMProperty* prop, double settingsPriority, bool warn);
254 
258  void resetPropertyToAppDefault(pqPropertyWidget* propWidget);
259 
263  void resetPropertyToUserDefault(pqPropertyWidget* propWidget);
264 
265  Q_DISABLE_COPY(pqProxyWidget);
266 
267  QSet<QString> DefaultVisibilityLabels;
268  QSet<QString> AdvancedVisibilityLabels;
269  bool ApplyChangesImmediately;
270  bool UseDocumentationForLabels;
271  bool ShowHeadersFooters = false;
272  class pqInternals;
273  pqInternals* Internals;
274 };
275 
276 #endif
pqPropertyWidget represents a widget created for each property of a proxy on the pqPropertiesPanel (f...
bool applyChangesImmediately() const
Definition: pqProxyWidget.h:65
bool useDocumentationForLabels() const
When this is true, the panel uses a descriptive layout where the documentation for properties is used...
Definition: pqProxyWidget.h:73
pqLabel is a subclass of QLabel that emits a clicked() signal when the label text is clicked...
Definition: pqLabel.h:15
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:30